perm filename E[CSP,SYS]3 blob
sn#156486 filedate 1975-04-25 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00238 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00020 00002 E -- DISPLAY EDITOR FOR STANFORD
C00030 00003 RIGHT HALF FLAGS
C00033 00004 CHARACTER TABLE FLAGS
C00036 00005 DD←←20000 RUNNING ON DATA DISK
C00038 00006 GETCHR, FSFIX, TSTSHF, CW, LEG, UUOS, XOPDEF, PURE, IMPURE,
C00041 00007 BEG, BEGSYS, BEGACT, BEGRPT, BEGDBG
C00044 00008 BEGRPG
C00046 00009 BEG0, BEG1, BEG1A, BEG2, BEGBKP
C00050 00010 BEG3,BEG4
C00053 00011 MAIN, FNF, FNF2
C00055 00012 CMDIN, CMDLUP, CMDEX, CMDX, CMDX2
C00058 00013 CMDED, CMDRD, CMDRD2, MINUS, PLUS, NUMS, INFIN, ALTSET
C00060 00014 CMDERR, ERR, POPJ1, EXTNUL, CPOPJ, CBTAB, ICHTAB, ILLRDO, ILLDIR, ILLMES, ILLMS2, ERRX, ILLBK
C00062 00015 INIT, INIT0, INIT1, INI1, IOBARF
C00066 00016 CMDSP
C00069 00017 XCMDS, XDISP, MCMDS, MDISP
C00071 00018 EXTEND, EXTEN1, EXTL0, EXTL, EXTL1, EXTL2, EXTL3
C00073 00019 EXTLK0, EXTLK, EXTAMB, EXTNUL, EXTNF, EXTAM2, EXTBUF, EXTBFE
C00075 00020 READON, ROSET, READWR, NORDWR, CANCEL, SNKOFF, SNKON, DPYALW, DPYSKI, NORDOW
C00077 00021 DDTGO, R, DRAW, DRAWX, PPSET, LINCNT
C00080 00022 GETOUT, GETOU1, FINISH, FINI1, FINI2, GORPG, QUIT, CLOSIT, GODRD
C00082 00023 NEWPAG, NEWPG, NEWPG0, NEWPG1, REREAD, PGINIT, NODEL, PGERR, FINSRT
C00086 00024 UNWIND, WIND, WIND1, LT, GT, LTE, GTE, TOP, BOT, JMP, UPARR, DWNARR
C00088 00025 XMARK--The `M' commands.
C00099 00026 DELLIN, DELPOS
C00101 00027 DELLP, DELL2
C00103 00028 DELPM, DELPM1, DELPM2, DELPM3
C00105 00029 DELPAG, DELPG1, ADJPG, ADJPGL
C00107 00030 RCOMP, RCOMP1, RCOMP2, RCOMPX
C00108 00031 DELETE, DELET1, ADDPAG
C00110 00032 APPEND, APPLUZ
C00112 00033 APPEN2, PMTXT, PMPAG
C00114 00034 INSERT
C00115 00035 INSER1, INSER2, INSER3, INSER4, INSER5
C00116 00036 INSER8, DIRADD
C00118 00037 INSER6, INSER7, MARK
C00119 00038 CONTQ
C00121 00039 ATTACH, ATTCH1, ARGCHK, ARGCHN
C00123 00040 ATTDO, ATTDO0, ATTDO2, ATTDO1
C00125 00041 ATTREP, ATTEX
C00127 00042 ATTKIL, ATTKL, ATTSRC, GPAGL, GPAGL0, GPAGL1, GPAGL2, GPAGL3, ATTWRT
C00129 00043 ATTCOP, ATTCP1, ATTCP
C00130 00044 ATTCP0, ATTCPL, ATCMOR, ATTCP2, ATTCP3, GPAGL
C00132 00045 EDIT, EDIT1, LINED, LINL1, EDDSP, EDARG, EDARGX
C00134 00046 EDFULL, EDTAB, EDNUL, EDCR, AGAIN, EDRP1, EDRPT
C00136 00047 EDGL, EDGL1, EDGL2, EDGL2A
C00139 00048 EDGL3, EDGL4, REEDIT, EDTMOR, EDGDSP, EDTAB2, PTOUT, PTPNT
C00142 00049 EDCR2, EDACT, EDITIT, REPLIN, PUTBAK
C00145 00050 EDPUT, EDPLR
C00147 00051 EDPS, EDPL, EDPLUZ
C00148 00052 EDSNK, EDSNK2, EDSNK3, ESDSP, ESALT
C00149 00053 CRDSP, REGCR, REGCR1, REGCR2
C00150 00054 CONTCR, CNTCR2, METACR, REPRST, REPRS2
C00152 00055 LECR, DUBLCR, DUBCR2
C00154 00056 INSONA, INSONE, INSNUL, INSNLP
C00156 00057 LININS, LINSLP, LINS1, LINGLP, LIDSP, LINTAB
C00158 00058 LINCR1, LINCR, LICCR, LINALT, LINCOM
C00159 00059 LINSTO, LINST1
C00161 00060 SETWRT, SETWR2, SETWRX, BTAB, BUF, RBUF
C00162 00061 FRD, FRD0, FRD1, NOEXT, NOPRG, NOPPN, NOSWIT, SWITL
C00165 00062 SETDEV, GETNAM, GETNML, GETP, GETPL, DTYI1, DTYI, DTYI2
C00167 00063 DOSWIT, NTYI, NTYIL, NTYIM, EDFIL, EDFIL2, SRCFIL, DSTFIL
C00169 00064 RSCAN, RSCAN0, RSCAN1, RSCAN2, RSCAN3, RSCAN4, RSCN4B, RSCN4C, RSCN4A, RSCN0A
C00173 00065 RSCAN5, RSCAN6, RSCAN7, RSCAN8, SYSCCK, CRECHK
C00175 00066 RSTYI, TYI1, TYI2, TYI3, TYIX, TYI4
C00177 00067 TYI, TYIT, TYIU
C00178 00068 TMPRED, TMPRD1, TMPRD2, TMPRDX, RPGRD1, BKPRED
C00184 00069 TMPWRT, BKPWRT
C00187 00070 FILERR, FILTYP, FILSTR, PPNTYP, FILETB
C00189 00071 SIXTYO, SIXTYL, SIXTY2, SIXTYN, SIXTNL, SIXTNN, PNTYO, PNTYOL
C00190 00072 UUOH, UUODSP, UFCE, UTYPCH, UTYPC2, UTYPDE, UTYPOC
C00192 00073 UTYPR, UTYPR1, USORRY, UFATAL
C00193 00074 OPENI, OPNOI, IOPEN, SETI, SETRLD, OPNDEV, RELDEV, OPNLUZ
C00197 00075 RLD, RLD1, RLD2, RLDX, RLDLUZ, FIXEOF, ENTLUZ, ENTL2
C00202 00076 EXTCHK, EXTCH1, EXTCH2, EXTCH3, EXTCH4, EXTTAB
C00204 00077 OPENW, OPENO, SETO, FPAUSE, PAUSE, PAUS2
C00206 00078 CLOSO, WRBUF, WRBF1, WRBF2, ENTR, OBUF
C00207 00079 MORCOR, INTLUZ, INTDSP, PDLOV, PDLOV1, PDLOV2, PDLOV3, ISAV, TSINT, TSNINT
C00210 00080 FSINI, FSINI1, MORCOR
C00213 00081 FSGET, FSLUP0, FSLUP, FSGRAB, FSXIT
C00214 00082 FSNEWT, FSNEWP, FSNEW
C00215 00083 FSUSED, FSTSML, FSNEXT, FSHRET, FSLLUZ
C00217 00084 FSLSCN, FSLSCL, FSLFR, FSLSHF, FSLSLP, FSLMOV, FSLDON
C00219 00085 FSHSCN, FSHSCL, FSHFR, FSHSHF, FSHSLP, FSHSR, FSHMOV
C00221 00086 FSBLT, POPTJ, FSBLT1
C00222 00087 FSBLT2, FSBLT3, FSHBLT, FSHBL2
C00223 00088 PNTREL, SHFTB, STDSH1, STDSHF, RELOC, RELOCL
C00225 00089 FSGIVE, FSGIV1, FSGIV2
C00226 00090 CORCHK, CRUNCH, CMPACT
C00228 00091 ENDSET, ENDFIX
C00229 00092 FSCHK, FCLUP1, FCLUP2, FCFR, FCDON
C00231 00093 FUCHK, MOVIT, MOVTX
C00233 00094 PURINI, PLCHK, PL2CHK, PLCHKL, PLSCN0, PLSCN, PLSCN1, PLSCN2, PLSCN3
C00235 00095 PURCHK, PURCH1, PURCH2, PURCH3, PURC3A
C00238 00096 PURCH4, PURCH5, PURCH6, PURCH7, PURCLC, TYPHW, PURCK, PLCHK1, PLCHK2, PURFLG
C00240 00097 SAVIT
C00241 00098 CHECK, CHECK1, CHECK2
C00242 00099 CHKDIR, CHKDPL
C00244 00100
C00246 00101 CHKLST, CHKFS, CHKFSL, CHKFS2, CHKPNT, CHKPN2
C00247 00102 CHKPAG, CHKPGP
C00248 00103 CHKPG1, CHKPG2, CPDSP, CHKPGT, CHKPTL
C00250 00104 CHKPG3, CHKPG4, CHKPG5, CHKPG6
C00251 00105 CHKATT, CHKNAT
C00252 00106 CTAB 0-37
C00256 00107 CTAB 40-77
C00258 00108 CTAB 100-137
C00260 00109 CTAB 140-177
C00262 00110 GETDIR
C00266 00111 DIRCL2, DIRCL, DIRCL1, GETDR1
C00268 00112 DIRLIN, DIRLUP, DIRDON
C00271 00113 LOSDIR, BADDIR, NODIR, DIRNUM, GDDSP, LSKP1, DIRSHF, DIREND
C00274 00114 COPFIL, COPFL1, COPDO, COPYX, COPDAT, COPLUP
C00276 00115 COPCOR, COPCHK, YESCHK, COPCMD
C00277 00116 FORMAT, FMTOK, FMTDSP
C00283 00117 NEWDIR, NEWDLP, SKPDSP, NEWDFF, OPUT, OSET, TMPDIR
C00284 00118 MAKDIR, MAKDR0, MAKDR1, MAKDOL, MDOL1
C00286 00119 MDIL1, MDIL1A, MDIL2, MDIL2A, MDCSRC, MDCSR1, MD1DSP
C00288 00120 MDIL1B, MAKDLF, MAKDFF, MDFF2, MDFF3, MDCEOL, MD2DSP
C00290 00121 MD1CR, MD2CR, MD3CR, MD3CR1, MDIL3, MDCRCK, MDFIX
C00292 00122 CREATE, CREAT2, CTEXT
C00294 00123 RDPAGE, RDPGOK, RDSPAG, RDPAG0
C00296 00124 RDPAG2, RDPAG1, RDLINE, RDLLP, RDLTAB
C00298 00125 RDLCR, RDLLF, NUMSTR,NUMSIX,OCTSTR,OCTASC
C00301 00126 RDLFF, RDLDON, LINSET, RPDSP, RDLNUL
C00303 00127 RDPGLZ, SOSTST, SOSCHK, SOSCK2, PGMK, PGMK2
C00305 00128 DIRCHK, DIRNEW, DIRNW2, DIRNW1, TXTSHF
C00307 00129 FNDLIN, FNDPAG, FNDLN1, FNDLN2, FNDLN3
C00308 00130 REMPTR, FIXPTR, FNDPT1, FNDPT2, LPTRTB, DPTRTB
C00310 00131 DIRGET, DIRGL, DGEND, DRGSET
C00312 00132 NUM5, NUM5A, DIRHED, DIRTXT, DIREMK, DGDSP
C00314 00133 OUTDIR, OUTDOK, OUTDLP, ODDSP, ODDON, ODEXP
C00316 00134 INSDIR, DCLP1, DCLP2, DCNG, INSDL
C00318 00135 IDDSP0, IDDSP, IDTAB, INSD3, INSD4, SCOMS, SCOMS2
C00320 00136 IDNUL, IDDON, IDDONS
C00322 00137 DIRSET, DIRST1, DIRUP, DIRUP1, DIRUP2, DIRUP3
C00323 00138 DIRFIX, DIRFX1, DIRFX2, DIRFX3, DIRFX4, DIRFXN
C00325 00139 DISPLAY DATA STORAGE
C00327 00140 MORE DISPLAY STORAGE
C00328 00141 HEADERS & TRAILERS
C00329 00142 DPYINI, DPYCHK
C00332 00143 DPYI2, NODPY, WIPE, IWIPE
C00334 00144 SETSCR, NMVARR, MOVARR, SETARR
C00336 00145 ARRBOT, ARRTOP, SETWIN, WINCHK, WINCH2
C00338 00146 DISP, DISP0, DISP1, DISP2
C00340 00147 DISP3, DISP4, DISP5, DUMMY, EXCLR, EXSET,EXTST
C00342 00148 DISPAT, DISPAX
C00343 00149 DWNWIN, REWIN, DDISPX, DDSPX2, DDDONE, WIPIT, WIPL, WIPL2
C00345 00150 DDCOP, DDLUZ, LINREL, LINRLL, IDISP, IDISP2
C00346 00151 IIIARR, IIIAR2, IIIAR3
C00348 00152 LESET, LEADJ, LECLR
C00349 00153 DBLT, DBLT1, DBLT2, DBLT3, IDISPX, DISPX, PPBAJ1, POPBAJ, POPAJ
C00351 00154 PCOMPD, PCOMPI, PCOMPS, P2CMPD, P2CMPI
C00352 00155 DDISP, DDISP2
C00353 00156 DOARR, DOAR2, OFFARR, ONARR
C00354 00157 DDISPS, DDSPS2, DDSPS3, DDSPSX, DDSPS4
C00356 00158 DSPSAT, DSPSAX
C00357 00159 DBLTS, DBLTS2, DBLTSN, DBLTS3, DBLTS1, DBLTSA, DBLTA, DBLTA2
C00359 00160 TDISP, TDISP1, TDISP2, TDSP2A, TDISPX
C00361 00161 TDISPC, TDISP3, TDISP4, TDISP5, TYPE, TYPEL
C00362 00162 WRPAGE, WRPAG1, WRPAG2, WRBOOK
C00364 00163 WRPX0, WRPX, WRPX1, WRPX1A, WRPX1B, WRPX2
C00365 00164 WRPX3, WRPX4
C00366 00165 WRPOK, WRTIT, WRT0
C00367 00166 WRP1, WRLINE, WRLUP, WRLP2, WRRDO, WRRDO2, WRRDO3
C00369 00167 WRDSP, WRTAB, WRCHK, WRDONE, WRDON2
C00371 00168 WRPM, BTAB2
C00373 00169 FLSPAG, FLSPGL, FLSPG2, CLRWRT, CLRWR2
C00374 00170 TV, RSYS, RUN, RUN1
C00377 00171 RUNILL, RUNNON, RUNFNF, RUNDEV, RUNFIL
C00378 00172 SEARCH ROUTINES
C00380 00173 SREAD, SREAD1, SREAD2, SREAD3, SREAD4, SRSTOR, SRSTR2
C00392 00174 SRACT, SREAD5, SRALT, SRALT2, SRALUZ, SREDT
C00399 00175 FINDIT, FOUND, FNDMOV, FNDERR
C00403 00176 FIND
C00405 00177 DIRSRC, DFERR, SRCDF, SDFCR
C00407 00178 SSET, SSET2
C00408 00179 SCOMP, SCOMPX, SCOMPR
C00410 00180 SBARF, SBARF1, SARRGH, SFSGT, SFSGET, SFSPUT, SFSPTL
C00412 00181 SPARSE
C00413 00182 SPARS1, SPARS2, SPDSP, SSCAN, SSCANA, SSCANX
C00415 00183 SSCAN1, SSCN1A, SSCN1B, SSCQT, SSCBIN, SSCINF, SSCNOT, SSCUOP, SSCVB
C00417 00184 SSCLP, SSCDSP
C00418 00185 SGRAPH, SGRPH1, SGRPH2, SGRPHX, SGDO1, SGDO1X, SGDOX2, SGDSP, SGDO1B
C00420 00186 SGNOT
C00421 00187 SBACK, SBACK1, SBACK2, SBACK3, SBACK4
C00423 00188 SBBRCH, SBBR2
C00424 00189 SBCALC, SBCAL0, SBCAL1, SBCAL2, SBCAL3
C00425 00190 SBCAL4, SBCNON, SBCX, SBCOPL, SBCOP2, SBCEND, SBCEN2, SBCFIX, SBCFXL, SBCFXE, POPJ2
C00427 00191 SBCOK, SBCEN1, SBCLUZ, SBCLZ1, SBCNXT, SBCBP, SBCBPL
C00429 00192 SBCCB, SBCCB1, SBCCB2, SBCCB8, SBCCB3, SBCCB4, SBCCB5
C00431 00193 SBCCB6, SBCCB7, BITCNT, BITCN1
C00432 00194 NEWBIT, NEWBT0, NEWBT1, NEWBT2, NEWBT3, NEWBT4, NEWBT5
C00434 00195 NEWBTC, NEWBC1, NEWBC2, NEWBC3, NEWBNC, NEWBN1, NEWBN2, NEWBN3, NEWBCZ, NEWBNZ
C00436 00196 SCCOM, SCCNOT
C00437 00197 SCCBIT
C00438 00198 MAKBIT, MAKBT0, MAKBT1, MAKBTN, MAKBN2, MAKBTB, MAKBB3
C00440 00199 MAKBNB, MAKBBT, MAKBB2, MBDSP, MBIND, MBIND2
C00442 00200 SCGEN
C00443 00201 SCGEN1, SCGEN2, SCGEN3, SCGEN4, SCGEN5, SCGEN6
C00445 00202 SCGTST, SCGT2, SCGT3, SCGDSP, SCGCN, SCGCN2, SCGBTN, SCGBT
C00447 00203 SCGE, SCGE2, SCGEL, SCGBAK, SCGBK1, SCGBK2, SCGBK3, SCGFA, SCGNC, SCGNFA
C00449 00204 SCGHB, SCGHB0, SCGHB5, SCGHB1, SCGHB2, SCGHB3, SCGHB4, SCGHBX, SCGHX2
C00451 00205 SCGCB, SCGCB0, SCGCB1, SCGCB2, SCGCB3, SCGCB4, SCGCB5, SCGHCB
C00453 00206 SBTMAK, SBTMK1, SBTMK2, SBTMK3, SBTMK4, SCGENB, SCGHB, SSVINS, SCXCT, SBKNW, SBKNWA, SBKDSP
C00455 00207 SRCPAG, SRCPG1
C00457 00208 GBYTP, GBYTPL, GBTPX, GBPDSP, GBPTAB
C00458 00209 SRCPGF, SPFTAB, SPFCR, SPFLUZ
C00459 00210 SRCPGB, SPFTAB, SBKNL, SBKNUL
C00460 00211 SRCSET, SRCST1, SRCSTL, SRCST2
C00461 00212 SCALL, SRCHX, SRCHLX
C00462 00213 SCNBAK, SCNBKL
C00464 00214 SCONTF, SRCFNP, SRCFNB, SFNB2, SFRETR
C00466 00215 SRCFF, SFFNUL, SGTACS, SRTACS
C00467 00216 SRCFB, SFBNUL, SBKNB, SBKNB2, SIOERR, SBKNP
C00468 00217 JFILL, JUST, JUSTL1, JUSTL2, JDISP
C00477 00218 JUSTTB, JUSTSP, JUSTS2, JUSTSL, JUSTS3, JUSTSO, JSTSO2, JULMAR
C00480 00219 JUSMAR
C00485 00220 JUSTCR, JCRTB, JCR2, JFIX, JPTAB, JATAB
C00488 00221 NXTLIN, NXTLN2, JTAB, NXTBL
C00494 00222 JDUMP, JDMP2, JDLT, JDL1, JDISP2
C00498 00223 JDSP1, JDSP2, JDSP3, JDTAB, JFLUSH
C00500 00224 JDFIN
C00503 00225 JDFIN2, JSET, JSET2
C00505 00226 INDENT,ALINE,CENTER,JLEFT
C00508 00227 LEFMAR,SHIFTY
C00512 00228 MACRO FREE STORAGE - MFSCLR,GETMFS,FREMFS
C00514 00229 MACRO DEFINER INPUT WATCHERS - INCHWL,INCHSL,SNEAKW,INCHRS,etc.: MACTYI
C00516 00230 ZDATA,ZSIX,ZBLT,ZEDFIL,ZLIST,EXIST
C00527 00231 LAMBDA,EPSIL,NWFILE,HOME,QUERY,HOMEG,LAMBDG
C00535 00232 ********* BEG OF ESSAY DEFS *********
C00554 00233 SUBSTR
C00565 00234 SPOOLC
C00570 00235 BEGIN SPSUB
C00577 00236 TELBUF,CHKUP,CHECKU,CHTEXT,ASCASC,CHOUT3,CHOUT6
C00584 00237 TELLME,FBI
C00596 00238 PDL, PATCH, PAT, ZVARS, LEGTAB
C00598 ENDMK
C⊗;
;E -- DISPLAY EDITOR FOR STANFORD
;Written by Frederick H.G. Wright II
;with modifications by D. Poole, Art Samuel, and Stan Kugell.
;The Essay program was contracted by John Mccarthy and written by Stan Kugell
PRINTS /Type 0 to get ETV, 1 to get ESSAY, then <CTRL><META><LF>./
ESSFLG←←.INSER TTY:
IFE ESSFLG<TITLE ETV -- DISPLAY EDITOR FOR STANFORD↔SUBTTL FREDERICK H.G. WRIGHT II
PRINTS / You are assembling ETV, the Stanford Display Editor
/
PRINTS/ MAR.28,1975 E.29(P481) Apr.6 1975 E.31(P487) Apr.7 1975 E.32(P487)
APR 10 1975 E.33(P487) APR 14 E.34
E.32 contains code for TELLME but no automatic calling
E.32 Reloaded on April 8 with minor corrections.
E.33 With some automatic calling (checksum error and UFATAL calls) Apr. 10 1975.
E.34 ALINE bug fixed Apr.14 1975
E.35 Fix for file-directory disagreements. Apr. 18 1975
/>
IFN ESSFLG<TITLE ESSAY
PRINTS / You are assembling Essay.
/>
DEFINE ESSAY <IFN ESSFLG>
DEFINE NOESS <IFE ESSFLG>
COMMENT ⊗ TO PUT UP A NEW E WITH AN UPPER SEGMENT, USE THE COMMANDS:
.LOA %SE%1<%2V%1B ;LOADS WITH SYMBOLS AND NNRAID IN THE UPPER SEGMENT
.S 137 ;RENAMES UPPER, WRITE PROTECTS AND SETS ITS PROTECTION CONSTANT
.SSAVE SYS E ;BE SURE TO SSave (to keep the UPPER SEGMENT around)
Early versions of E that were up for varying lengths of time:
Nov. 6 1974. E.7 Nov. 8 1974. E.8 Nov.17 1974. E.10
Nov.18 1974. E.10 Dec. 3 1974. E.12 Dec. 9 1974. E.15
Dec.10 1974. E.16(P424) Dec.14 1974. E.17(P431) DEC.17 1974. E.18(P431)
Dec.18 1974. E.19(P431) Jan.3 1975. E.20(P439 Jan.5,1975 E.21(P439)
Jan.10,1975. E.22(P442) Jan 15,1975 E.23(P442) Mar.12,1975. E.26(P474)
Mar.13,1975 E.27 Mar.17 1975 E.27(P477) Mar.19 1975 E.28(P477)
DATA STRUCTURE.
A page of text is represented in memory as a theaded list of
items each representing a single line of the text. Each item in this
representation contains four words of header information, the text of
the line in question and one trailer word.
The first header word contains a TXTCOD, which for ordinary text
is a 2 in the left half and the total number of words in the right half.
This word is used by the free storage management routines. It does not
seem to be used by the text manipulation sections of the code. The word
count is duplicated in the trailer word which is also used only by the
free storage routines.
The second header word is a pointer word. It contains a
backward pointer in the left half pointing to the location of the
pointer word of the previous item and in the right half a forward
pointer to the location of the pointer word of the next item. The
location of the pointer word for the first item is contained in the word
at PAGE and the backward pointer for the first item points back to
PAGE. The last item on the page points to the word BOTSTR and this word
points back to this last item and forward to itself. When in the ATTACH
mode, the location ATTBUF points to the pointer word of the first
attached line and back to the pointer word of the last attached line.
The third word contains flag bits in the left half identifying
the type of the line and two 9-bit bytes in the right half. Flag bits
which have been identified are:
400000 the line is a page mark.
200000 the line is ARRLIN (CURRENT to which the arrow points).
100000 the line is WINLIN (the first line on the window).
040000 the line is an Essay reference (for the ESSAY version).
The first byte in the right half contains the total count of the
characters as the line is stored on the disk, where a TAB symbol counts
1 and the terminating CR and LF are counted.
The second byte contains the count of the characters as they are
displayed where a TAB is counted as the number of spaces it produces and
the terminating CR and LF are not counted.
The fourth word is the serial number of the line as kept in the
core. This number is changed every time that a change is made to the line
so this number then bears no relationship to the position of the line on
the page.
The text occupies an integral number of words and is padded out
with nulls.
The trailer word contains the count of the total words in the
item, including header and trailer words. This duplicates the
information in the right half of the first header word.
TABs are handled in a pecular way. When a TAB occurs it is stored
as a TAB and this is followed by as many spaces as the TAB in fact
produces in the text and then by a terminating TAB.
end of comment ⊗
NOLIT
;Register Most common usage
F←0 ;Flag bits
A←1 ;Argument value
B←2 ;CONTROL and META bits as stripped from command character.
C←3 ;Character
D←4 ;Dispatch table entry
E←5 ;Table location.
G←6
H←7
I←10
DSP←11 ;Dispatch table location (CTAB most of the time).
Q←14
T←15
TT←16
P←17 ;Always reserved as PDL pointer.
DEFINE STOPJ
{PUSHJ P,STOPJC
}
;Used to replace JRST 4,. and other fatal halts to inform ALS of trouble
;STOPJ USED FOR JRST 4,. terminating with a JRST 4,. as usual
;STOPC used for JRST 4,. WHEN ATTEMPT IS MADE TO CONTINUE
IFNDEF PURESW<PURESW←←1> ;DEFAULT TO SHARABLE PURE UPPER SEGMENT
IFNDEF DEBSW<DEBSW←←1>
IFNDEF BOOKMD<BOOKMD←←1>
;BOOKMD NON-ZERO PERMITS /B MODE FOR READING BOOKS. 0 DISABLES /B MODE.
COPNUM←←3 ;LOG OF # K OF CORE FOR TEMP COPY BUFFER
SRSIZ←←40 ;SIZE OF SEARCH STRING BUFFER
LPDL←←69
DPYBSZ←←=660*2
DSKI←←1
DSKO←←2
DSKSP←←4 ;Used for spooling file
DSKCH←←5 ;Used to write into bug file TELLME.001[E,ALS] , .002 etc.
SWP←←3
IFN BOOKMD, {
RPGO←←4 ;CHANNEL USED TO WRITE OUT .BKP FILE IN BKPSW MODE
};END BOOKMD
...←←0
;Type of display (kept in cell called DPY)
$TTY ←← 0 ;Teletype kludge
$DD ←← 1 ;Datadisk video type display
$III ←← 2 ;III Vector type display
;RIGHT HALF FLAGS
REDNLY←←1 ;READ ONLY MODE
COPY←←2 ;NEED TO DO COPY (← OR →)
DIROK←←4 ;HAVE COMPLETE DIR
UPDTXT←←10 ;LINE 1 CHANGED - UPDATE DIR AT WRPAGE
WRITE←←20 ;SOMETHING CHANGED - NEED TO WRITE IT
EOF←←40 ;INPUT EOF DETECTED - DO ANOTHER LOOKUP (LOSING SYSTEM!)
EDDIR←←100 ;EDITING THE DIRECTORY PAGE
ARG←←200 ;ARG WAS TYPED TO COMMAND
DSPSCR←←400 ;REDISPLAY SCREEN
DSPALL←←1000 ;REDISPLAY WHOLE SCREEN
FILLUZ←←2000 ;EDITING NONSTANDARD FORMAT FILE
REL←←4000 ;RELATIVE ARG (+ OR -)
NEG←←10000 ;NEGATIVE ARG
EDITM←←20000 ;DISPATCH IS FROM LINE EDIT
EDBRK←←40000 ;(WITH EDITM) COMMAND TYPED IN MIDDLE OF LINE
XPAGE←←100000 ;WILL EXPAND FILE FOR PAGE
UPDIR←←200000 ;NON-TEXT CHANGE TO DIR
ATTMOD←←400000 ;IN ATTACH MODE
;LEFT HALF FLAGS
ENTRD←←1 ;EDIT FILE HAS BEEN ENTERED
CLRBF←←2 ;CLEAR OBUF AFTER OUTPUT
NOSHUF←←4 ;DON'T SHUFFLE FREE STORAGE
NOCHK←←10 ;DON'T TRY TO CORE DOWN
OFFEND←←20 ;ARROW ON LINE N+1
NULLIN←←40 ;CURRENT LINE IS EMPTY
ARRPG←←100 ;ARROW POG IS SELECTED
TF1←←200 ;TEMP FLAG
PMLIN←←400 ;CURRENT LINE IS PAGE MARK
OKF←←1000 ;SHOULD TYPE "OK"
;New flags added by ALS. May be represented by 3 bits if space gets tight.
ALIN←←2000 ;ALINE FLAG
INDEN←←4000 ;INDENT FLAG
CEN←←10000 ;CENTER FLAG
JOINF←←20000 ;JOIN FLAG
ZATT←←40000 ;To save ATTACH on a Z-EPSIL command.
; 100000
; 200000
NGPUSE←←400000 ;Network Graphic User
;CHARACTER TABLE FLAGS
NSPEC←←400000 ;STANDARD SPECIAL CHAR (NULL OR RUBOUT) - MUST BE SIGN
FSPC←200000 ;FILE NAME DELIMITER
LSPC←←100000 ;SPECIAL CHAR IN LINE
NUMF←←40000 ;DIGIT
DSPC←←20000 ;SPECIAL DIR CHAR
LETF←←10000 ;LETTER - WITH LT2F => LOWER CASE
LT2F←←4000 ;ALONE => $%._
SSP1←←2000 ;TYPE 1 SPECIAL SEARCH STRING CHAR
SSP2←←1000 ; " 2 " ...
EDOK←←40 ;RIGHTMOST OF 4 BITS (SHIFT BY CONTROL BITS) FOR LINE EDITOR LEGALITY
;COMMAND DISPATCH FLAGS
NOEDIT←←200000 ;DISPATCH DIRECTLY FROM LINE EDIT WITHOUT REPLACING LINE
DOEDIT←←100000 ;REPLACE LINE BEFORE DISPATCHING FROM LINE EDIT
;IF NEITHER OF THE ABOVE, RE-EDIT LINE AT SAME CURSOR POS (CHAR IS NO-OP)
NOATT←←40000 ;ILLEGAL IN ATTACH MODE
NORDO←←20000 ;ILLEGAL IF READ-ONLY
;10000 ;USER MODE BIT MUST BE UNUSED
SACMD←←4000 ;USES SEARCH ARG
SSCMD←←2000 ;SPECIAL ACTION WHEN ENTERED FROM SEARCH
LPDESC←←3 ;# EXTRA WDS DIR ENTRY
DPBIT←←400000 ;DIRPT ENTRY
D1BIT←←200000 ;DIRP1 ENTRY
RPMASK←←77 ;MASK FOR RELATIVE PAGE # FIELD
RPBYTE←←<220600,,> ;BYTE PNTR FOR ABOVE
LLDESC←←3 ;# EXTRA WDS TEXT LINE
PMARK←←400000 ;THIS LINE IS A PAGE MARK
ARRBIT←←200000 ;LINE IS ARRLIN
WINBIT←←100000 ;LINE IS WINLIN
PTRBIT←←040000 ;LINE IS COMMENT OR REFERENCE POINTER
LOKBIT←←200000 ;LOCKS DOWN FS BLOCK (CAN'T BE SHUFFLED)
MAXLIN←←=42
ATTMAX←←8
DD←←20000 ;RUNNING ON DATA DISK
III←←400000 ;" " III (BITS FROM GETLIN)
SUPCCR←←2 ;BREAK TABLE BIT TO SUPPRESS CTRL1-CR HACK
DVDSK←←200000 ;DISK BIT FROM DEVCHR
MININT←←23 ;LOWEST INT BIT #
ADRSIZ←←17 ;# BITS NEEDED TO ADDRESS PERMANENT CODE
ZZ←←.
LOC 137
IFN PURESW,<
JRST [ NOESS,< MOVSI 'E '> ;UPPER NAME ONCE SYSTEMIFIED
ESSAY,< MOVE ['ESSAY ']>
SETNM2
JRST 4,137
MOVE P,[-LPDL+1,,PDL] ;Temp stack for checksum compute
PUSHJ P,CHKUP ;Check upper segment before setpro
MOVEM T,CHKSUM
MOVNI 1
SETUWP
JRST 4,137
MOVSI 155000
SETPRO
JRST 4,137
CALLI 12]
>
IFG DEBSW-PURESW,<
JRST [ JSP E,PURINI
CALLI 12]
>
ORG ZZ
FOR @! FOO IN(SORRY,FATAL)
{DEFINE FOO(X)
{ FOO!U [ASCIZ /X/]}
}
;GETCHR, FSFIX, TSTSHF, CW, LEG, UUOS, XOPDEF, PURE, IMPURE,
DEFINE GETCHR(X)
{ILDB C,INPNT
SKIPGE X,CTAB(C)
XCT @CTAB(C)}
DEFINE GETCH1(X)
{ILDB C,INPNT
TDNE X,CTAB(C)
XCT @CTAB(C)}
DEFINE GETCH2(X,Y)
{ ILDB C,Y
TDNE X,CTAB(C)
XCT @CTAB(C)}
DEFINE FSFIX(X,Y)
{ HRRI Y,(X)
SUB Y,FSEND
LEG MOVEM Y,@FSEND
LEG HRRZM Y,-1(X)
HRRZM X,FSEND}
IFN DEBSW{DEFINE TSTSHF
{ SKIPE SHFMOD
PUSHJ P,MOVIT}}
IFE DEBSW{DEFINE TSTSHF{}}
DEFINE CW(C1,D1,C2,D2,C3,D3){BYTE(8)D1,D2,D3(3)C1,C2,C3,4}
;THESE MACROS MAKE A LINKED LIST AROUND AND THROUGH
;PURE AND UNPURE PARTS FOR CHECKSUMING THE PURE PARTS
;AN ERROR WILL RESULT IF THE SAME MACRO IS CALLED
;TWICE WITHOUT CALLING THE OTHER MACRO.
%SEG←←0
IFE PURESW{
DEFINE PURE{IFN %SEG{!} %SEG←←1 PURBEG←←.}
DEFINE IMPURE{IFE %SEG{!} %SEG←←0
PURBEG,,PURLK2↔PURLK2←←.-1
PURBEG,,PURLNK↔PURLNK←←.-1}
PURLNK←←PURLK2←←0}
;THESE MACROS SET RELOCATION TO THE PROPER SEGMENT FOR PURE OR UNPURE CODE
;AN ERROR MESSAGE WILL RESULT IF THE SAME MACRO IS CALLED TWICE WITHOUT
;CALLING THE OTHER MACRO.
IFN PURESW{
TWOSEG
RELOC 400000
RELOC
DEFINE PURE{IFN %SEG{!} %SEG←←1 RELOC}
DEFINE IMPURE{IFE %SEG{!} %SEG←←0 RELOC}}
;THIS MACRO SHOULD PRECEDE A LINE OF CODE WHICH CAN
;GENERATE A LEGAL ILL MEM REF.
LEGNUM←←0
DEFINE LEG{FOR @! X←LEGNUM,LEGNUM{LEG!X←←.} LEGNUM←←LEGNUM+1
}
DEFINE UUOS{FOR @! X IN(TYPCHR,TYPDEC,TYPOCT,SORRYU,FATALU,XTTYUU,SNEAKW,SNEAKS)}
ZZ←←0
UUOS{ZZ←←ZZ+1
OPDEF X[ZZ⊗33]
}
DEFINE XOPDEF(X,AC){OPDEF X[XTTYUU AC,]}
FOR X ⊂ ({INCHRW,0},{INCHRS,2},{INCHWL,4},{INCHSL,5})
{XOPDEF ( X ) ↔ }
NUUOS←←ZZ+1
EXTERN JOBREL,JOBFF,JOBAPR,JOBTPC,JOBDDT,JOBREN,JOBOPC,JOBCNI
PURE
;BEG, BEGSYS, BEGACT, BEGRPT, BEGDBG
IFN DEBSW,<JRST BEGDBG>
JRST BEGRPT
BEG: JRST BEG0 ;RUN OR ET COMMAND
JRST BEGRPG ;RPG START. AC'S CONTAIN PARAMS
MOVEM 16,EPDL ;SYSTEM AXXCOM START
MOVEM 17,EPDL2 ;17[SIXBIT COMMAND, 16[ASCII DELIM
JSP P,INIT ;INITIALIZE
MOVE T,EPDL2 ;GET COMMAND NAME
MOVEM T,SYSCMD ;STOW IT
MOVE A,[440700,,BUF] ;INITIAL BYTE POINTER
MOVE C,EPDL ;INITIAL CHARACTER IN "SCAN"
; PUSHJ P,TYIT
; JRST BEGACT
; SETACT [BRKTAB,,BRKTAB] ;APPARENT NO OP -- RPH
INWAIT
HRLOI T,377777 ;SET T INFINITE
PUSHJ P,RSCN4A ;SCAN REMAINER OF COMMAND FOR ARGS
BEGSYS: LDB C,[301400,,SYSCMD] ;GET 2 CHARACTERS OF COMMAND NAME
PUSHJ P,SYSCCK ;DO WE KNOW THEM
JRST BEG1 ;YES. NOW WE READ FILE NAME FROM TTY
JRST BEG0 ;DONT UNDERSTAND COMMAND. RESCAN.
BEGACT: MOVE T,[440700,,[ASCIZ /
/]]
MOVEM T,TYIPNT
JRST BEGSYS
BEGRPT: JSP P,INIT ;INITIALIZE
PUSHJ P,TMPRED ;TRY TO READ TMPCORE FILE
JRST BEG0A
PUSH P,TYIPNT ;SAVE POINTER TO ARGS
MOVEM G,TYIPNT ;POINT TO COMMAND
PUSHJ P,GETNAM ;AND READ IT
MOVEM A,SYSCMD
POP P,TYIPNT ;NOW POINT TO ARGS AGAIN
JRST BEGSYS ;AND LOOK LIKE AXXCOM STARTUP
IFN DEBSW,<
BEGDBG: JSP P,INIT ;HERE FOR DEBUGGING. INITIALIZE
INWAIT ;WAIT FOR SOMETHING TO BE TYPED
HRLOI T,377777 ;SET CHARACTER COUNT TO INFINITE
PUSHJ P,RSCAN0 ;READ COMMAND, AVOID RESCAN
JRST BEG0A ;ACT NORMAL
>
;BEGRPG
;HERE AT RPG STARTUP.
BEGRPG: MOVEM 17,RPGACS+17
MOVEI 17,RPGACS
BLT 17,RPGACS+16 ;SAVE RPG PARAMETERS
JSP P,INIT0 ;INITIALIZE
HRRZ T,RPGLIN
CAILE T,=999
SETZB T,RPGLIN
MOVEM T,SLINE ;STARTING LINE NUMBER
SKIPGE T,RPGPAG
MOVEI T,
MOVEM T,SPAGE ;STARTING PAGE NUMBER
MOVSI T,'DSK'
MOVEM T,EDFIL-1 ;DEFAULT DEVICE
SKIPN T,RPGFIL
JRST GETOU1 ;NO FILE NAME - NO EDIT. EXIT
MOVEM T,EDFIL ;SAVE EDIT FILE NAME
SKIPN T,RPGPPN
MOVE T,PPN
MOVEM T,EDFIL+3 ;EDIT FILE PPN
MOVE T,RPGEXT
HLLZM T,EDFIL+1 ;EDIT FILE EXT
SETZM EDFIL+2
SETZM EDFIL+4
HRLOI TT,1
TRNE T,100000 ;INSPECT MODE FLAGS
MOVEM TT,EDFIL+4 ;SET /N NO DIRECTORY
TRNE T,400000
SETOM CREASW ;CREATING
TRNE T,200000
SETOM RDONLY ;/R READONLY
PUSHJ P,ZLIST ;SAVE ALL THIS SHINY NEW DATA IN ZDATA
JRST BEG3
IMPURE
RPGACS: BLOCK 11 ;PLACE TO SAVE RPG PARAMETERS
RPGPPN: 0
0
RPGEXT: 0
RPGFIL: 0
RPGLIN: 0
RPGPAG: 0
0
PURE
;BEG0, BEG1, BEG1A, BEG2, BEGBKP
BEG0: JSP P,INIT ;INITIALIZE
BEG0.1: PUSHJ P,RSCAN ;RESCAN TTY
BEG0A: SKIPN TYIPNT ;WAS THERE ANYTHING THERE?
OUTSTR [ASCIZ /
FILE? /] ;NO. ASK FOR SOME.
BEG1: MOVEI D,EDFIL ;POINTER TO DEPOSIT?
LDB C,[301400,,SYSCMD] ;GET THE COMMAND NAME
PUSHJ P,CRECHK ;WAS IT CREATE?
JRST [SETOM CREASW ;YES. SET FLAG
JRST BEGSY2]
IFN BOOKMD, {
CAIN C,'RE' ;"READ" COMMAND?
JRST BEGBKP ;YES
};END BOOKMD
JUMPN C,BEGSY1 ;WAS IT SOME SORT OF COMMAND AT ALL?
BEGSY2: PUSHJ P,FRD ;READ FILE NAME (TTY OR RESCANNED DATA)
JRST FNERR ;OOPS.
BEGSY3: SKIPN EDFIL
JRST GETOU1
HLLM D,SRCFIL
HLLM D,DSTFIL
IFN BOOKMD, {
SKIPN BKPSW ;"READ" COMMAND USED?
JRST BEGSY4 ;NO
PUSH P,C
PUSHJ P,BKPRED ;LOOK FOR <FILENM>.BKP FILE (LIKE RPG FILE)
POP P,C
SETOM BOOKSW ;BKPSW IMPLIES BOOKSW
SETOM RDONLY ;BOOKSW IMPLIES RDONLY
JRST BEG1A
BEGSY4:
};END BOOKMD
TLNN D,740 ;ANY FILENAME, EXTENSION, OR PPN SPECIFIED?
JRST BEG1B ;NO
MOVEI G,(C)
PUSHJ P,TMPWRT
LDB C,[301400,,SYSCMD]
PUSHJ P,CRECHK
SETOM CREASW
MOVEI C,(G)
BEG1B: CAIE C,"←"
CAIN C,"→"
TROA F,COPY
JRST BEG1A
MOVEM C,TRMCHR#
MOVEI D,EDFIL2
PUSHJ P,FRD
JRST FNERR
MOVE G,[,SRCFIL-EDFIL2(A)]
CAIN C,"→"
HRRI G,DSTFIL-EDFIL2
MOVE A,[-5,,EDFIL2]
HRRZM A,@G
AOBJN A,.-1
HLLM D,EDFIL2(G)
SKIPN @SRCFIL
SETOM CREASW
BEG1A: PUSHJ P,TYIT
JRST BEG3
BEG2: PUSHJ P,TYI
JRST BEG3
JRST BEG2
FLOSE: SUB P,[1,,1]
FNERR: OUTSTR [ASCIZ /ILLEGAL FILE SPECIFICATION./]
JRST FNF1
IFN BOOKMD, {
BEGBKP: SETOM BKPSW# ;BKPSW MEANS WE WERE STARTED BY "READ" CMD TO USE .BKP FILE
SETOM BOOKSW# ;BOOKSW MEANS WE ARE IN /B MODE--NO FILE MODIFYING ALLOWED
};END BOOKMD
BEGSY1: MOVE H,TYIPNT
SKIPN TCPNT
PUSHJ P,TMPRED
JRST BEGSY2
PUSHJ P,FRD
JFCL
MOVEM H,TYIPNT
HRLI D,200000
PUSHJ P,FRD0
JRST FNERR
JRST BEGSY3
;BEG3,BEG4
BEG3: PUSHJ P,SNKON
PUSHJ P,DPYSKI
SKIPE CREASW
PUSHJ P,CREATE
BEG4: MOVEI D,@SRCFIL
MOVEI A,1
PUSHJ P,OPENI
JRST FNF
MOVE T,@SRCFIL+4
AOS SRCFIL+4
MOVEM T,@SRCFIL+4
SKIPN DIR
PUSHJ P,GETDIR
MOVE T,EDFIL+4
TRNN F,COPY
IOR T,@SRCFIL+4
ADDI T,1
HRRZM T,DIRPAG#
PUSHJ P,COPFIL
MOVEI D,EDFIL
MOVEI A,1
PUSHJ P,OPNOI
PUSHJ P,OPNLUZ
TRZE F,UPDTXT
PUSHJ P,OUTDIR ;GETDIR ASKING FOR WRITE
MOVE A,[ASCID / /]
MOVEM A,HEDNAM
HRRZM A,HEDNAM+1
MOVE A,[HEDNAM+1,,HEDNAM+2]
BLT A,ROFLG-1
MOVE A,[260700,,HEDNAM]
MOVEM A,TYOPNT
MOVEI D,EDFIL
PUSHJ P,FILSTR
MOVEI A,<BYTE(7),,,"/","R"(1)1>
SKIPE RDONLY
TROA F,REDNLY
MOVEI A,1
IFN BOOKMD, {
SKIPE BOOKSW
MOVEI A,<BYTE(7),,,"/","B"(1)1>
};END BOOKMD
MOVEM A,ROFLG
MOVE A,[HEDNAM,,HED2NM]
BLT A,ROFLG2
MOVE T,PAGES
CAIE T,2
MOVEI T,1
SKIPGE A,SPAGE ;FIRST PAGE TO LOOK AT
MOVEI A,-1(T) ;NONE - ASSUME DIR
ADD A,DIRPAG
JUMPG A,.+2
MOVEI A,1
PUSHJ P,RDPAGE
JFCL
SKIPE MARKS ;Are there any line marks
PUSHJ P,XMPAGE ;Yes, so get last mark on page data
TRNE F,REDNLY!DIROK
JRST .+3
TRO F,COPY
JRST BEG4
SETZM TYIPNT
PUSHJ P,DPYINI
PUSHJ P,PGINIT
PUSHJ P,TMPWRT
IFN BOOKMD, {
SKIPGE A,NEWBKP
OUTSTR [ASCIZ /WILL CREATE .BKP FILE
/]
};END BOOKMD
HLRZ A,RPGLIN
TRNE A,376000
JRST MAIN
TRZN A,400000
JUMPG A,[MOVEM A,EDMOV↔MOVE D,CMDSP-1↔MOVEI A,↔JRST MAIN2]
TLNN F,ZATT ;To preserve ATTACH status if necessary
PUSHJ P,ATTACH
JFCL
;MAIN, FNF, FNF2
MAIN:
IFN DEBSW,<
SKIPE CHKMOD
PUSHJ P,CHECK
SKIPE CHKMOD
JRST MAIN1
PUSHJ P,FSCHK
JFCL
SKIPN SHFMOD
JRST MAIN1
SKIPGE SAVMOD
PUSHJ P,SAVIT
PUSHJ P,MOVIT
PUSHJ P,FSCHK
JFCL
MAIN1:>
TDZ F,[TF1,,EDITM!EDBRK]
TLZE F,OKF
OUTSTR[ASCIZ/ OK /]
MOVEI DSP,CMDSP
PUSHJ P,CMDIN
JFCL
MAIN2:
IFN DEBSW,<
EXCH D,LSTCOM#
EXCH D,LSTCO2#
EXCH D,LSTCO3#
EXCH D,LSTCO4#
EXCH D,LSTCO5#
MOVE D,LSTCOM
EXCH A,LSTARG#
EXCH A,LSTAR2#
EXCH A,LSTAR3#
EXCH A,LSTAR4#
EXCH A,LSTAR5#
MOVE A,LSTCHR# ;The last characters typed
EXCH A,LSTCH1#
EXCH A,LSTCH2#
EXCH A,LSTCH3#
EXCH A,LSTCH4#
EXCH A,LSTCH5#
MOVE A,LSTARG
>
PUSHJ P,(D)
TLO F,OKF
JRST 2,@[MAIN]
JRST MAIN2
FNF: PUSHJ P,EXTCHK
JRST BEG4
MOVEI D,LKUP
PUSHJ P,FILERR
FNF1: TRZA F,COPY
FNF2: JSP P,INIT1
MOVE T,ZINDEX ;Prepare to overwrite bad file name.
CAME T,ZOLDX ;Only overwrite if there is some place to go to
SETZM ZDATA(T)
OUTSTR [ASCIZ/
TRY AGAIN: /]
CLRBFI
SKIPN TYIPNT
JRST BEG1
SETZB T,TYIPNT
SKIPE TT,TCPNT
PTLOAD T
SKIPE TT,RSPNT
PTLOAD T
JRST BEG1
;CMDIN, CMDLUP, CMDEX, CMDX, CMDX2
CMDIN: TRZ F,ARG!REL!NEG
SETZB A,C
EXCH C,COMCHR#
JUMPN C,CMDEX ;Do we have a saved chr. ?
CMDLUP: PUSHJ P,CMDRD ;No. Read a new one.
CMDEX: LDB B,[70200,,C] ;Get its ctrl bits.
TRZ C,¬177
;Save data for TELLME file
MOVEI T,0
TRNE B,1 ;Is CONTROL bit on?
ADDI T,"α"
LSH T,7
TRNE B,2 ;Is META bit on?
ADDI T,"β"
LSH T,7
ADD T,C
MOVEM T,LSTCHR ;Save for storing at MAIN2 time
MOVSI E,EDOK
LSH E,(B)
TDNE E,CTAB(C) ;Is it a line editor command ?
JUMPGE DSP,CMDED ;Yes.
CMDEDR: TLZE C,1
INCHRW T ;We SNEAKed this chr, so now gobble it.
SKIPA D,@CTAB(C);Get dispatch tbl. entry.
XCMDX: MOVEI E,
CMDX: TLNE D,37 ;Is this a 2-level dispatch ?
MOVE D,@D ;Yes. Get final disp. addr.
TDNE E,D
JRST CMDERR
JUMPL D,(D) ;Dispatch immediately on some commands.
TRNN F,ARG
MOVEI A,1 ;If no repeat argument typed, assume 1.
CAILE A,=500
MOVEI A,=500
TRNE F,NEG
MOVN A,A
TLNN D,NORDO ;(?) Does this command change the file ?
JRST CMDX2 ;No.
TRNE F,EDDIR
JRST ILLDIR
IFN 0, { ;NOW, IN /B MODE, WE ARE ALSO IN /R MODE
SKIPE BOOKSW
JRST ILLBK
};END BOOKMD
TRNE F,REDNLY
JRST ILLRDO
CMDX2: TLNE D,NOATT
TRNN F,ATTMOD
JRST POPJ1
ILLATT: JSP A,ILLMES
ASCIZ /IN ATTACH MODE/
;CMDED, CMDRD, CMDRD2, MINUS, PLUS, NUMS, INFIN, ALTSET
CMDED: SKIPN DPY ;We have a command to be passed to the line editor.
JRST CMDEDR ;Has to be a dpy, or no line editor.
TLNE C,1 ;Now get fake dispatch tbl. pointer.
SKIPA D,-2(DSP) ; Getting readt to go to EDSNK.
MOVE D,-1(DSP)
JRST CMDX
CMDRD: PUSHJ P,DISP ;Update display, if needed.
XCT CHRTST ;Arg. to DISP
TDNE F,SNKTST
TRNE F,ARG
JRST CMDRD2
SNEAKW C,
CAIE C,15
TLOA C,1
CMDRD2: INCHRW C
CAIE C,15
POPJ P,
INCHRW C
XORI C,15≠12
POPJ P,
MINUS: TRC F,NEG
PLUS: TRO F,REL
JRST CMDLUP
NUMS: TRO F,ARG
IMULI A,12
ADDI A,-"0"(C)
JRST CMDLUP
INFIN: TRO F,ARG
MOVEI A,-1
JRST CMDLUP
ALTSET: MOVEI D,CPOPJ
POPJ P,
;CMDERR, ERR, POPJ1, EXTNUL, CPOPJ, CBTAB, ICHTAB, ILLRDO, ILLDIR, ILLMES, ILLMS2, ERRX, ILLBK
CMDERR: JSP D,ERRX
ERR: OUTSTR [ASCIZ /
SORRY -- /]
OUTSTR [ASCIZ /UNRECOGNIZED CONTROL CHARACTER -- /]
TRNE B,1
OUTSTR [ASCIZ /<ctrl>/]
TRNE B,2
OUTSTR [ASCIZ /<meta>/]
MOVEI B,(C)
ROT B,-7
CAIG C,15
CAIGE C,11
TROA B,B
HRRI B,@ICHTAB-11(C)
CAIN C,40
HRRI B,[ASCIZ /<space>/]
CAIN C,177
HRRI B,[ASCIZ /<bs>/]
CMDER2: OUTSTR (B)
; OUTSTR [ASCIZ /
;/]
OUTSTR [ASCIZ/ /]
POPJ1: AOS (P)
CPOPJ: POPJ P,
ICHTAB: FOR X IN (tab,lf,vt,ff,cr){[ASCIZ /<X>/]
}
ILLRDO:
IFN BOOKMD, {
SKIPE BOOKSW
JRST ILLBK
};END BOOKMD
JSP A,ILLMES
ASCIZ \IN /R MODE\
ILLDIR: JSP A,ILLMES
ASCIZ /ON DIRECTORY PAGE/
IFN BOOKMD, {
ILLBK: JSP A,ILLMES
ASCIZ \IN /B MODE\
};END BOOKMD
ILLMES: JSP D,ERRX
ILLMS2: OUTSTR [ASCIZ /
SORRY -- /]
OUTSTR [ASCIZ /ILLEGAL /]
OUTSTR (A)
OUTSTR [ASCIZ /.
/]
JRST POPJ1
ERRX: TLZE C,1
INCHRW T
POPJ P,
;INIT, INIT0, INIT1, INI1, IOBARF
INIT: SETZM RPGACS
MOVE [RPGACS,,RPGACS+1]
BLT RPGACS+17 ;CLEAR ACS FROM ALL BUT RPG STARTUP
INIT0: SETZM TYIPNT
SETZM TCPNT
SETZM MDEFPT
SETZM MXCTPT
SETZM SYSCMD
SETZM ZDATA ;This avoida a needless message on ET starts
SETZM ESCIEN ;THIS INHIBITS ESC I PROCESSING, OMd WHEN FIND STARTED
ESSAY,< SETZM ESEPSY>
INIT1: MOVEM P,PDL ;SAVE RETURN ADDRESS WHERE WE CAN POPJ
MOVEI
MOVEI 17,1
BLT 17,17 ;CLEAR REAL AC'S
MOVE P,[-LPDL+1,,PDL] ;SET UP STACK (RETURN HAS BEEN PUSHED)
RESET ;CLEAN UP SYSTEM ASPECTS OF JOBS
MOVE A,[ZVARS,,ZVARS+1]
BLT A,EVARS
SETZM MARKS
MOVE A,[MARKS,,MARKS+1]
BLT A,MARKS+NMARKS-1 ;Init. the marks array.
PUSHJ P,MFSCLR ;Init. macro free stg.
ESSAY,< PUSHJ P,ESINIT ;ESSAY initialization>
MOVE T,[PUSHJ P,UUOH] ;OUR UUO HANDLER
MOVEM T,41
MOVEI T,TSINT ;ADDRESS OF INTERRUPT HANDLER
MOVEM T,JOBAPR
MOVEI T,JBICNI ;USE DIFFERENT THREE WORDS FOR NEW INTS
MOVEM T,.JBINT↑
MOVEI T,220000 ;ENABLE FOR PDLOV AND MPV
APRENB T,
MOVSI T,4 ;ENABLE FOR ESC I INTS ON NEW SYSTEM
INTENB T,
ACCTIM T, ;Get date (left half) and time (right half)
MOVEM T,DATBLK# ;Date is OK as is
HRRZS T ;but must fix time.
IDIVI T,=60 ;Convert to minutes
HRRM T,DATBLK
MOVEI T, ;AND USER'S REAL NAME
GETPPN T,
MOVEM T,RPPN#
MOVEI T, ;AND USER'S ALIAS
DSKPPN T,
MOVEM T,PPN#
SETOM FIRPAG
SETZM DIR
;SETUP TABLE VBBITS TO HAVE A BIT ON FOR EACH CHARACTER WHICH DOESN'T HAVE
;ONE OF THE FOLLOWING BITS ON: LETF, LT2F, NUMF
;TABLE IS THE LEFTMOST 32 BITS OF 4 WORDS
MOVSI A,LETF!LT2F!NUMF
MOVEI B,40
MOVEI C,176
MOVEI E,VBBITS+4-1
INI1: TDNN A,CTAB(C)
IORM B,1(E)
JUMPL B,[MOVEI B,20↔SOJA E,.+2]
LSH B,1
SOJG C,INI1
MOVE T,FABITS+1
ANDM T,VBBITS+1
PUSHJ P,BITCNT
HRLZM T,VBBITS
MOVE T,[[LETF!LT2F!NUMF,,]-BEG+400000,,CTAB]
MOVEM T,5(E)
MOVE A,[-5,,EDFIL]
HRRZM A,SRCFIL-EDFIL(A)
HRRZM A,DSTFIL-EDFIL(A)
AOBJN A,.-2
IFG DEBSW-PURESW,{
SKIPN PURFLG
JSP E,PURINI
}
JRST FSINI ;GO INITIALIZE FREE STORAGE
;CMDSP
;MAIN COMMAND DISPATCH - INDEXED INTO VIA CTAB
;The CC macro, as here defined, is used to associate relative table addresses
;with the associated command characters. For a more detailed explanation see
;the comment for CTAB on page 106.
DEFINE CC !(A){%!A←←.-CMDSP} ;TAGS FOR CTAB (PHASE 0 WOULD DO IF :: WORKED)
;rel.
;addr. for
NOATT+EDOK*16,,EDSNK ;-2
NOATT+EDOK*10,,EDIT ;-1
CMDSP: SETZ CMDERR ;0 nul
SSCMD,,NMVAR1 ;1 rubout
,CRDSP(B) ;2 CR
SETZ CMDERR ;3 LF
SETZ CMDERR ;4 TAB
FORMF ;5 FF
400000!NOEDIT,,ALTSET ;6 ALT
SETZ CMDERR ;7 letter
SETZ CMDERR ;10 ;⊗
SETZ NUMS ;11 digits
REPEAT 6,<SETZ CMDERR> ;12 thru 17 reserved for special find symbols
; ∧ ¬ ⊂ ⊃ ∀ ≡
SETZ CMDERR ;20 ∨
SETZ INFIN ;21 ∞
SETZ CMDERR ;22 |
CC(P) SSCMD,,NEWPAG
CC(M) XMARK
CC(E) GETOUT
CC(W) WIND
CC(L) UNWIND
CC(PLS) SETZ PLUS
CC(MIN) SETZ MINUS
CC(LT) LT
CC(GT) GT
CC(LE) LTE
CC(GE) GTE
CC(T) TOP
CC(B) BOT
CC(J) JMP
CC(X) SETZ EXTEND
CC(D) SACMD!NOEDIT+NOATT,,DELLIN
CC(DA) DOEDIT+NOATT,,DWNARR
CC(UA) DOEDIT+NOATT,,UPARR
CC(U) SSCMD!DOEDIT,,NMVAR1
CC(V) NOEDIT!DOEDIT,,DRAW
;CC(.) NOEDIT!DOEDIT,,WRPAGE
CC(.) WRPAGE
CC(Q) NOATT,,CONTQ
CC(A) SACMD!SSCMD,,ATTACH
CC(C) SACMD!SSCMD,,ATTCOP
CC(K) ATTKIL
CC(R) ATTREP
CC(F) DOEDIT,,FINDIT
CC(I) NOEDIT!NOATT,,DUBLCR
CC(FF) SSCMD!DOEDIT,,FORMF
CC(LA) LFARR
CC(RA) RTARR
CC(EPSIL) EPSIL
CC(LAMBDA) LAMBDA
ESSAY,<
CC(FRALL) ESCOMT
>
CC(G) HOMEG
CC(PI) LAMBDG
CC(H) HOMEF
CC(QUERY) QUERY
CC(EXIST) EXIST
CC(BSLAS) DOEDIT,,BSLAS
;XCMDS, XDISP, MCMDS, MDISP
BEGIN XDISPS ;TO FLUSH MACROS
GLOBAL D ;GRRRR
;EXTEND MODE COMMAND TABLE (MUST BE ALPHABETICAL)
DEFINE XCMD{FOR X IN (<ALIGN,SACMD>,<ALINE,SACMD>,<APPEND,NOATT>,CANCEL,<CENTER,SACMD>
,<CLOSE,,CLOSIT>,<DDTGO,NOEDIT!DOEDIT>
,<DELETE,NOATT!NORDO>,<DIRED,NOATT,GODRD>,DPYALWAYS,DPYSKIP,<DRAW,NOEDIT!DOEDIT>
,<DRD,NOATT,GODRD>,FIND,<GORPG,NOATT>,<INDENT,SACMD>
,<INSERT,↑INSCMD::NOATT!NORDO>,<JFILL,SACMD>,<JLEFT,SACMD>,<JOIN,SACMD>
,<JUST,SACMD>
,LINCNT,<MARK,NOATT!NORDO>,<NWFILE,SACMD>
,PPSET,QUIT,READONLY,READWRITE,<RSYS,DOEDIT>,<RUN,DOEDIT>
,SNKOFF,SNKON,SPOOLC,TELLME,TV,TYPE,XSPOOL)}
DEFINE MCMD{FOR X IN (READONLY,READWRITE)}
DEFINE CMDM(A,B,C){<SIXBIT /A/>
}
DEFINE DISPM(A,B,C){B,,IFIDN {C}{}{A;}C
}
FOR @! Y IN (X,M)
{ ,Y!DISP-Y!CMDS(D)
↑Y!CMDS:Y!CMD
{ CMDM X
}↑N!Y!CMDS←←.-Y!CMDS
↑Y!DISP:Y!CMD
{ DISPM X
}IFN .-Y!DISP-N!Y!CMDS{!}
}
BEND XDISPS
;EXTEND, EXTEN1, EXTL0, EXTL, EXTL1, EXTL2, EXTL3
EXTEND: MOVE E,[-NXCMDS,,XCMDS]
MOVE T,B ;Reconstruct the initial activator
LSH T,7
ADD T,C
MOVEM T,XSAVE# ;Save for possible use in repeat command
EXTEN1: OUTSTR [ASCIZ/
COMMAND? /]
PUSHJ P,DISP
XCT LINTST
MOVE D,[440600,,TT]
MOVEI TT,
MOVE G,[440600,,XMSK]
SETZM XMSK#
MOVEI T,77
MOVE Q,[440700,,EXTBUF]
EXTL0: PUSHJ P,TYIU
JRST EXTNUL
TLNN T,LETF!NUMF!LT2F
JRST EXTL0
JRST EXTL1
EXTL: PUSHJ P,TYIU
JRST EXTLK0
EXTL1: CAME Q,[100700,,EXTBFE-1] ;DON'T CAUSE CLOBBERAGE IF HE'S VERBOSE
IDPB C,Q
TLNN T,LETF!NUMF!LT2F
JRST EXTL2
TLNN D,770000
JRST EXTL ;IGNORE AFTER 6
SUBI C,40
IDPB C,D
IDPB T,G ;GENERATE MASK
JRST EXTL
EXTL2: MOVEM Q,EXTPNT#
EXTL3: PUSHJ P,TYI
JRST EXTLK
CAME Q,[100700,,EXTBFE-1]
IDPB C,Q
JRST EXTL3
;EXTLK0, EXTLK, EXTAMB, EXTNUL, EXTNF, EXTAM2, EXTBUF, EXTBFE
EXTLK0: MOVEM Q,EXTPNT
EXTLK: MOVEI T,
IDPB T,Q ;TERMINATOR FOR OUTSTR
CAIN C,175
JRST EXTNUL
MOVE D,E
CAMLE TT,(D) ;FIND FIRST COMMAND ≥ HIS
AOBJN D,.-1
JUMPGE D,EXTNF ;NONE
MOVE T,XMSK
AND T,(D)
CAME T,TT
JRST EXTNF ;DOESN'T MATCH - HE LOSES
MOVE T,XMSK
AND T,1(D)
CAMN T,TT
; JRST EXTAMB ;NEXT ONE WORKS ALSO - NOT UNIQUE
PUSHJ P,EXTAMX
MOVE T,LSTCHR ;Report two characters (caps)
LSH T,1
LSHC T,6 ;Add first character
LSH T,1
LSHC T,6 ;Add second character
ADDI T,10040 ;Back to ascii
MOVEM T,LSTCHR
MOVE D,@-1(E)
JRST XCMDX
EXTAMX: MOVEI T,-XCMDS(D)
ADDI T,XDISP
MOVE TT,(T)
CAMN TT,1(T)
POPJ P,
POP P,T
EXTAMB: MOVEI D,EXTAM2
POPJ P,
EXTNF: JSP D,CPOPJ
EXTNF2: SKIPA T,[[ASCIZ/UNKNOWN COMMAND -- /]]
EXTAM2: MOVEI T,[ASCIZ/AMBIGUOUS COMMAND -- /]
OUTSTR [ASCIZ /
SORRY -- /]
OUTSTR (T)
MOVEI T,
IDPB T,EXTPNT
OUTSTR EXTBUF ;WHATEVER HE TYPED
OUTSTR [ASCIZ/
/]
JRST POPJ1
EXTNUL: JSP D,CPOPJ
ANDI C,177
CAIN C,15
POPJ P,
OUTSTR [ASCIZ / ABORTED
/]
JRST POPJ1
IMPURE
EXTBUF: BLOCK 30
EXTBFE←←.
PURE
;READON, ROSET, READWR, NORDWR, CANCEL, SNKOFF, SNKON, DPYALW, DPYSKI, NORDOW
READON:
IFN BOOKMD, {
SKIPE BOOKSW
JRST NORDOW ;CANT CHANGE TO READONLY FROM /B MODE
};END BOOKMD
TRNE F,REDNLY
POPJ P,
PUSHJ P,WRPAGE
PUSHJ P,CLOSIT
SETOM RDONLY
MOVEI T,<BYTE(7),,,"/","R"(1)1>
TRO F,REDNLY
ROSET: MOVEM T,ROFLG
MOVEM T,ROFLG2
MOVE T,SCRTOP
HLLZS DPYTAB(T)
TRO F,DSPSCR
POPJ P,
READWR:
IFN BOOKMD, {
SKIPE BOOKSW
JRST NORDOW ;CANT CHANGE TO READWRITE FROM /B MODE
};END BOOKMD
TRNE F,FILLUZ
JRST NORDWR
SETZM RDONLY
MOVEI T,1
TRZE F,REDNLY
JRST ROSET
POPJ P,
IFN BOOKMD, {
NORDOW: OUTSTR [ASCIZ /
SORRY -- /]
OUTSTR [ASCIZ \CANNOT CHANGE FROM /B MODE.
\]
JRST POPJ1
};END BOOKMD
NORDWR: SORRY FILE NOT FORMATTED
JRST POPJ1
CANCEL: MOVE A,ARRL
MOVEM A,SLINE
PUSHJ P,FLSPAG
PUSH P,TOPWIN
MOVE A,FIRPAG
PUSHJ P,REREAD
POP P,A
JRST SETWIN
SNKOFF: TDZA T,T ;NO SNEAK AT BEGINNING OF LINE
SNKON: MOVSI T,NULLIN ;SNEAK AT BEGINNING OF LINE
MOVEM T,SNKTST#
POPJ P,
DPYALW: SKIPA T,[¬<JFCL>] ;ALWAYS UPDATE DISPLAY
DPYSKI: HRLOI T,<(¬<INSKIP>)> ;ONLY UPDATE DISPLAY IF NO INPUT READY
SETCAM T,CHRTST#
MOVNM T,LINTST#
POPJ P,
;DDTGO, R, DRAW, DRAWX, PPSET, LINCNT
DDTGO: SKIPN TT,JOBDDT
JRST EXTNF2
TRNN TT,400000
JRST .+3
UNPURE
FATAL COULDN'T UNPURIFY UPPER
LDB T,[331100,,1(TT)]
CAIN T,<PUSHJ>⊗-33
JRST DDTG2 ;DDT - LOSE
HRRZ TT,-3(TT)
MOVE T,MASK
MOVEM T,1(TT)
NOESS,< MOVE T,[441100,,[BYTE (9)"E","T","V",200+":","2","4",200+"I"]]>
ESSAY,< MOVE T,[441100,,[BYTE (9)"E","S","S","A","Y",200+":","2","4",200+"I"]]>
MOVEM T,-1(TT)
DDTG2: PUSHJ P,WIPE
PPSEL ;Select piecee of paper 0
PGACT ;Zero address field means invisible glass
MOVEI T,CPOPJ ;SGK 10-FEB-75 RETURN FROM RAID VIA <CTRL>P
MOVEM T,JOBOPC
;SGK SETZM JOBOPC
PUSHJ P,@JOBDDT ↔R←←CPOPJ
DDTRET: DPYOUT 17,[[0]↔0]
PGSEL
TLZ F,ARRPG
IFG DEBSW-PURESW,{PUSHJ P,PURCLC}
PUSHJ P,PPSET
SETZM BLNKL
JRST DRAWX
DRAW: PUSHJ P,DPYCHK
PUSHJ P,PPSET
PUSHJ P,WIPE
DRAWX: TRO F,DSPALL
SETOM LEPOS
ESSAY,< SKIPE ESCGIS# ;¬0 MEANS TYPE αβ∀ INSTRUCTIONS OUT
OUTSTR [ASCIZ ↔
Type/Edit comment. Return with <CTRL>G. ↔]
SETZM ESCGIS>;ESSAY
POPJ P,
PPSET: SKIPN T,DPY
POPJ P,
SOJLE T,.+3
PPSEL
DPYPOS -1400 ;Move regular page printer off the page
PPSEL 1
DPYPOS @DPPPOS
DPYSIZ @DPPSIZ ;DPPSIZ contains G=3 L=1 (at least for the DD)
POPJ P,
LINCNT: SETZM TYOPNT
OUTSTR [ASCIZ / Line /]
TYPDEC ARRL
OUTSTR [ASCIZ / of /]
TYPDEC LINES
TYPCHR "
"
JRST POPJ1
;GETOUT, GETOU1, FINISH, FINI1, FINI2, GORPG, QUIT, CLOSIT, GODRD
GETOUT: TRZE F,ATTMOD
JRST ATTEX
PUSHJ P,FINISH
GETOU1: CALLI
MOVE A,JOBFF
SOJ A,
CORE A, ;CORE BACK DOWN
JRST 4,. ;WHAT??
CALLI 12
FINISH: PUSHJ P,WRPAGE
FINI1: TLZE F,ENTRD
CLOSE DSKO, ;MAKE SURE THE FILE GETS OUT
PUSHJ P,TMPWRT
IFN BOOKMD, {
SKIPE BKPSW ;STARTED BY "READ" COMMAND?
PUSHJ P,BKPWRT ;YES, WRITE OUT <FILENM>.BKP FILE
};END BOOKMD
FINI2: PPACT ;STOP ANDY FROM WRITING
MOVE T,PPSIZ
ADDM T,SCRSIZ ;ERASE PP TOO
PUSHJ P,WIPE ;BLAST THE SCREEN
SKIPE DDACT ;WAIT FOR WIPE
DPYOUT [0↔0]
POPJ P,
GODRD: PUSHJ P,FINISH ;START UP DIRED
MOVEI
MOVEI 17,1
BLT 17,17 ;SOMEWHERE IN HERE GARBAGE CAN CAUSE STORAGE MAP
MOVEI A,[SIXBIT /SYS DIRED DMP/ ↔ 1 ↔ 0]
SWAP A,
JRST 4,.
GORPG: PUSHJ P,FINISH
MOVEI
MOVEI 17,1
BLT 17,17 ;SOMEWHERE IN HERE GARBAGE CAN CAUSE STORAGE MAP
MOVEI A,[SIXBIT /SYS RPG DMP/↔1↔0]
SWAP A,
JRST 4,.
QUIT: PUSHJ P,FLSPAG
PUSHJ P,FINI1
JRST GETOU1
CLOSIT: TLZN F,ENTRD
POPJ P,
RELEAS DSKO,
SETZM JOBJDA+DSKO
MOVE T,ICHN
CAIE T,DSKO
POPJ P,
MOVE A,IBLK
MOVEI D,EDFIL
MOVEI C,DSKO
PUSHJ P,IOPEN
PUSHJ P,OPNLUZ
POPJ P,
;NEWPAG, NEWPG, NEWPG0, NEWPG1, REREAD, PGINIT, NODEL, PGERR, FINSRT
;We enter here when we ask for a new page. This requires a DIRECTORY lookup.
;The start of the directory is pointed to by DIR and its end by DIREND while
;the current page is pointed to by DIRPT. The directory is stored much as
;any other page of data except for a few changes to enable the free storage
;routines to spare it from garbage collections.
JRST DIRSRC
NEWPAG: TRNE F,NEG
SUB A,XPAGES
TRNE F,ARG
TRNE F,REL
NEWPG: ADD A,CURPAG
NEWPG0: PUSH P,A
PUSHJ P,WRPAGE ;OUT WITH THE BAD PAGE
PUSHJ P,FLSPAG
AFSHIT←←0 ;BET YOU CAN'T GUESS WHAT THIS MEANS.
IFN AFSHIT,< ;THE FOLLOWING EXCERCISE IN BAD TASTE. 3-29-74
PUSH P,B
DATE A,
IDIVI A,=31*=12
CAIN B,=93
PUSHJ P,[AOS A,NEWFO1# ;SO IT WON'T BE TOO BOTHERSOME
TRNE A,3
POPJ P,
MOVE A,[1000,,[1B18]] ;SET TEMPORARY TO CHANNEL 22 (OCTAL)
VDSMAP A,
JFCL ;PROBABLE SKIP RETURN
MOVE A,[700015,,2] ;TEMP AUDIO MAP TO CH 15. 1/2 SECOND
ADSMAP A,
MOVSI A,4000 ;RESET TO PERMANENT MAPPING
VDSMAP A,
JFCL
POPJ P,]
POP P,B
>;IFN AFSHIT
POP P,A
NEWPG1:
REREAD: PUSHJ P,RDPAGE ;AND IN WITH THE GOOD
PUSH P,[PGERR]
SKIPE MARKS ;Are there any line marks
PUSHJ P,XMPAGE ;Yes, so get last mark on page data
PUSHJ P,CORCHK
PGINIT: MOVN A,GTDEL
ASH A,-1
ADD A,SLINE
PUSHJ P,SETWIN
MOVEI A,1
EXCH A,SLINE
PUSHJ P,SETARR
TRO F,DSPALL
POPJ P,
PGERR: SORRY NO SUCH PAGE
JRST POPJ1
FORMF: CAIN B,2 ;The form feed command code.
JRST FINSRT ;Trying to insert a FORM.
TRNE F,REL ;Is there a relative argument?
JRST FORMF1 ;Yes.
FORMF3: MOVE A,BOTWIN ;The usual foreward command case.
MOVE T,CURPAG
CAMGE T,PAGES
CAMG A,LINES
SOJA A,WIND1
MOVEI A,1
JRST NEWPG
FORMF1: TRNN F,NEG
JRST FORMF3 ;If + handle as usual
MOVE A,TOPWIN
MOVE T,CURPAG
CAILE T,1
CAILE A,1
JRST FORMF2
MOVNI A,1
PUSHJ P,NEWPG
TRZ F,NEG!REL
MOVE A,LINES ;To get to the bottom of the page.
JRST WIND1
FORMF2: MOVNI A,1
JRST WIND
;Use with caution because of SOS (P)
FINSRT: MOVE D,INSCMD
PUSHJ P,XCMDX
JFCL
SOS (P)
POPJ P,
;UNWIND, WIND, WIND1, LT, GT, LTE, GTE, TOP, BOT, JMP, UPARR, DWNARR
;The <CONTROL>L and <CONTROL>W commands come here as well as <FORM>.
UNWIND: MOVNS A
WIND: JUMPE A,CPOPJ
JUMPL A,[AOJA A,.+1]
MOVEI B,0
CAIE A,1 ;Special treatment for this case only.
JRST .+5
MOVE B,ATTNUM ;To allow for space occupied by ATTACH
CAILE B,ATTMAX ;which may be 0 but
MOVEI B,ATTMAX ;which is never more than ATTMAX
MOVNS B
ADD B,SCRSIZ
IMULI A,-3(B)
ADD A,TOPWIN
WIND1: CAML A,LINES
ADDI A,1
PUSHJ P,SETARR
CAMG A,TOPWIN
SUBI A,-3(B)
JRST SETWIN
LT: MOVNS A
GT: ASH A,2
MOVAR1: AOS (P)
JRST MOVARR
LTE: SKIPA A,GTDEL
GTE: MOVN A,GTDEL
JRST NMVAR1
TOP: MOVE A,TOPWIN
PUSHJ P,SETARR
JRST ARRTOP
BOT: MOVE A,BOTWIN
SOJ A,
PUSHJ P,SETARR
JRST ARRBOT
JMP: JUMPLE A,.+3
MOVE A,ARRL
JRST SETWIN
MOVE B,ATTNUM
CAILE B,ATTMAX
MOVEI B,ATTMAX
JUMPL A,.+6
MOVN A,SCRSIZ
ASH A,-1
ADD A,ARRL
ADDI A,3(B)
JRST SETWIN
MOVE A,ARRL
ADDI A,3(B)
SUB A,SCRSIZ
JRST SETWIN
UPARR: MOVNS A
DWNARR: PUSHJ P,MOVARR
PUSH P,[1]
PUSH P,[211] ;SET FOR CTRL1-TAB
TLNE F,NULLIN
SETZM -1(P) ;ONLY CRLF - FLUSH THE CTRL1-TAB (WILL LOSE AT END OF LINE)
JRST EDIT1
;XMARK--The `M' commands.
;MARKS,XMARK,XMPAGE,XXADD,XXSUB,XPADD,XPSUB
NMARKS←←20 ;Max. no. of marks.
IMPURE
XXARRL: 0 ;Holds line number at a page insertion or deletion
XXPAGE: 0 ;Holds index value to MARKS at first entry for current page
XXLINE: 0 ;Holds MARKS line number from first entry for current page
MARKS: BLOCK NMARKS
0 ;Table stop
-1 ;Sure stop
PURE
XMARK: TRNE B,2 ;Is it a make or remove mark?
JRST XMAKE ;Yes
SKIPN MARKS ;Are there any marks?
JRST XXNONE ;No
MOVE D,ARRL
HRL D,CURPAG ;Get current location into mark-table format
CAMN D,MARKS ;Are we at the first mark?
SKIPE MARKS+1 ;And is it the only one?
JRST XMARK1 ;No
outstr [asciz /
There is only one MARK and you are there!
/]
JRST POPJ1
XXNONE: OUTSTR [ASCIZ / There are no marks
/]
JRST POPJ1
XFULL: OUTSTR [ASCIZ / Table is full
/]
JRST POPJ1
XTHERE: OUTSTR [ASCIZ / Already marked!
/]
JRST POPJ1
XNOTF: OUTSTR [ASCIZ / Not marked!
/]
JRST POPJ1
XMARK1: MOVEI E,0
TRNE F,NEG ;Backward search?
JRST XBACK ;Yes
CAML D,MARKS(E) ;Is D larger or equal to the largest?
MOVEI D,0 ;Yes so start over
CAMGE D,MARKS+1(E)
AOJA E,.-1 ;Stops because marks block is terminated by a -1
SOJLE A,XMOVE ;Do we need to go further?
SOJGE E,.-1 ;Back up another one
AOJA E,.-5 ;Woops, off upper end of table
XMOVE: PUSH P,E ;Found it.
HLRZ A,MARKS(E)
CAME A,CURPAG ;Save time if on right page already.
PUSHJ P,NEWPG0 ;Go to right page.
POP P,A
HRRZ A,MARKS(A)
SUB A,ARRL
JRST MOVARR ;Put arrow on right line.
XBACK: CAMG D,MARKS(E)
AOJA E,.-1
SKIPG MARKS(E) ;Is this a legitimate entry?
MOVEI E,0 ;No so go to the top of the list
AOJGE A,XMOVE ;Do we need to go further?
AOJA E,.-3 ;Go down 1 and test if off bottom of active list
XMAKE: TRNE F,ARG
SKIPE A
JRST XWRITE ;Not a clear command
XZERO: SETZM XXPAGE
MOVE A,[XXPAGE,,XXLINE]
BLT A,MARKS+NMARKS-1
OUTSTR [ASCIZ /
All marks have been cleared
/]
JRST POPJ1
XWRITE: TRNE F,NEG ;Is it a delete?
JRST XDELET ;Yes
SKIPLE MARKS+NMARKS-1 ;Is table full?
JRST XFULL ;Yes
MOVE D,ARRL
HRL D,CURPAG ;Into form stored
MOVEI E,0
CAMGE D,MARKS(E)
AOJA E,.-1
CAMG D,MARKS(E)
JRST XTHERE ;A mark is already there
MOVE A,ARRL
CAMG A,XXLINE ;Is new mark later than XXLINE
JRST .+3 ;Yes
MOVEM A,XXLINE
MOVEM E,XXPAGE ;Reset for newly inserted mark
EXCH D,MARKS(E) ;Make room
JUMPLE D,.+2
AOJA E,.-2
POPJ P,
XDELET: MOVE E,XXPAGE ;Get starting place
MOVE D,ARRL
HRL D,CURPAG
XDEL2: CAMGE D,MARKS(E) ;Find entry
AOJA E,.-1 ;Try again
CAME D,MARKS(E)
JRST XNOTF ;It was not marked
MOVE D,ARRL
CAMGE D,XXLINE ;Is it the the latest on this page?
JRST XDEL4 ;No
HLRZ T,MARKS+1(E) ;Is it also the last one on this page?
CAME T,CURPAG
JRST XDEL3 ;This was the only one
HRRZ T,MARK+1(E)
MOVEM T,XXLINE ;Only XXLINE needs fixing, XXPAGE will be unchanged
JRST XDEL4
XDEL3: SETZM XXLINE
SETZM XXPAGE
OUTSTR [ASCIZ /
Last MARK on this page has been removed
/]
XDEL4: MOVE D,MARKS+1(E) ;Close ranks
MOVEM D,MARKS(E)
JUMPE D,.+2
AOJA E,.-3
POPJ P,
;This routine reloads XXPAGE and XXLINE for the new page
XMPAGE: PUSH P,T
PUSH P,E
MOVEI E,0
SETZM XXPAGE
SETZM XXLINE
HLRZ T,MARKS(E)
CAMLE T,CURPAG
AOJA E,.-2
CAME T,CURPAG
JRST XMPAG2 ;No marks on this page
MOVEM E,XXPAGE ;Store index for first mark on this page
HRRZ T,MARKS(E)
MOVEM T,XXLINE ;Store the line number
XMPAG2: POP P,E
POPT: POP P,T
POPJ P,
;This code handles a single line deletion
XXSUB: PUSH P,T
MOVE T,XXLINE
CAMGE T,ARRL
JRST POPT ;To restore T and exit
MOVE TT,[-1]
JRST XXALL
;This code handles multiple line additions and deletions
XLALL: PUSH P,T
MOVE T,XXLINE
CAMGE T,ARRL
JRST POPT ;Restore T and exit as all marks are before ARRL
MOVE TT,-2(P) ;Get push'ed value
JRST XXALL
;This code handles a single line insertion
XXADD: PUSH P,T
MOVE T,XXLINE
CAMGE T,ARRL
JRST POPT ;To restore T and exit
MOVEI TT,1
;This code is entered from XXADD, XXSUB and XLALL.
XXALL: PUSH P,E
MOVE E,XXPAGE ;Get index of first line affected
SUB T,ARRL
JUMPL T,XXALL5 ;We are through
ADD T,TT ;Note that TT may be negative
JUMPL T,XXALL6 ;To delete mark for attached or deleted line
ADDM TT,XXLINE ;XXLINE line was affected
JRST XXALL3 ;Now fix the line itself
XXALL2: SUB T,ARRL
JUMPL T,XXALL5 ;We are through
ADD T,TT ;Note that TT may be negative
JUMPL T,XXALL6 ;To delete mark for attached or deleted line
XXALL3: ADDM TT,MARKS(E)
XXALL4: HLRZ T,MARKS+1(E)
CAME T,CURPAG
JRST XXALL5 ;All fixed
HRRZ T,MARKS+1(E)
AOJA E,XXALL2
XXALL5: POP P,E
POP P,T
POPJ P,
XXALL6: PUSH P,E ;Save E while flushing mark
HRRZ T,MARKS(E)
CAME T,XXLINE
JRST XXALL8 ;XXLINE referenced line was not it
HLRZ T,MARKS+1(E) ;Is there another mark on this page?
CAMN T,CURPAG
JRST XXALL7 ;There is.
SETZM XXPAGE
SETZM XXLINE ;There was not so zero XXLINE
OUTSTR [ASCIZ /
Last MARK on this page has been obliterated.
/]
JRST XXALL8
XXALL7: HRRZ T,MARKS+1(E)
MOVEM T,XXLINE ;Temporary fix but value will have to be changed
OUTSTR [ASCIZ /
Remember: marks on attached or deleted lines are obliterated.
/]
XXALL8: MOVE T,MARKS+1(E) ;Shuffle to close ranks
MOVEM T,MARKS(E)
SKIPLE T ;Ranks are closed
AOJA E,.-3
SKIPN E ;Was last mark destroyed?
OUTSTR [ASCIZ / There are no more marks.
/]
POP P,E ;Get value before the shuffle
SOJA E,XXALL4 ;Entry has been moved up, remember.
;This routine handles page mark insertions
XPADD: PUSH P,E
MOVEI E,0
JRST XPADD2
XPADD1: HLRZ T,MARKS(E)
ADDI T,1 ;Compensate for fact that CURPAG was upped 1 by insertion
CAMGE T,CURPAG
JRST XPADD4
XPADD2: CAME T,CURPAG ;Is it on the split page?
JRST XPADD3 ;No, so only page value needs to be changed
HRRZ T,MARKS(E) ;Now attend to line number
SUB T,XXARRL ;Where is it with respect to insertion
ADDI T,1 ;This should go before the pushj.
JUMPLE T,XPADD4 ;It was before so we are through
HRRM T,MARKS(E) ;Fix line number
XPADD3: MOVE T,[1,,0]
ADDM T,MARKS(E)
AOJA E,XPADD1 ;Safe because table terminates with -1
XPADD4: POP P,E
POPJ P,
;This routine handles page mark deletions
XPSUB: PUSH P,E
MOVEI E,0
JRST XPSUB2
XPSUB1: HLRZ T,MARKS(E)
SUBI T,1 ;Compensate for fact that CURPAG was decreased by deletion
CAMGE T,CURPAG
JRST XPADD4 ;The rest are OK.
XPSUB2: CAME T,CURPAG ;Is it on the ajoined portion?
JRST XPSUB3 ;No, so only page value needs to be changed
MOVE T,XXARRL ;Line number on ajoined portion needs to be increased
ADDM T,MARKS(E) ;Fix line number
XPSUB3: MOVN T,[1,,0]
ADDM T,MARKS(E)
AOJA E,XPSUB1 ;Safe because table terminates with -1
;DELLIN, DELPOS
;DELLIN DELETES C(A) LINES AT THE POINTER
DELLIN: TRNE F,EDITM
SOJN B,REEDIT ;FROM EDITOR AND NOT CTRL1
PUSH P,TOPWIN
JUMPGE A,DELPOS
MOVNS A ;MINUS DELETE - BACK UP THE ARROW, THEN TREAT AS PLUS
AOJ A,
CAMLE A,ARRL ;NMVARR WILL MAKE THIS CHECK,
MOVE A,ARRL ;BUT WE SHOULD ALSO LIMIT OUR DELETE
SOJ A,
PUSH P,A
PUSHJ P,NMVARR
MOVN A,(P)
ADDM A,-1(P) ;ADJUST WINDOW BY AMOUNT FLUSHED
POP P,A
DELPOS: SETZM DELPGS#
MOVE B,LINES
SUB B,ARRL
CAILE A,1(B)
MOVEI A,1(B) ;LIMIT US TO WHAT WE'VE GOT
JUMPE A,POPAJ
PUSH P,[0]
TLO F,NOCHK
MOVE B,ARRLIN
HLRZ G,(B)
MOVE C,A
PUSH P,C
;DELLP, DELL2
DELLP: SKIPGE T,1(B)
JRST DELPM
DELPR: TLNE T,WINBIT
SETZM WINLIN
LDB T,[111100,,1(B)]
MOVN T,T
ADDM T,CHARS
MOVEI A,(B)
HRRZ B,(B)
PUSHJ P,FSGIVE
SOJG C,DELLP
TLZ F,PMLIN
MOVE T,1(B)
TLNE T,PMARK
TLOA F,PMLIN
JRST DELL2
TRNE F,EDITM
JRST DELLP
DELL2: HRRZM B,ARRLIN
HRRM B,(G)
HRLM G,(B)
MOVSI T,ARRBIT
IORB T,1(B)
TRNE T,777
TLZA F,NULLIN
TLO F,NULLIN
SUB C,(P)
SUB P,[1,,1]
ADDM C,LINES
SKIPG XXLINE ;Are there marks on this page
JRST .+4
PUSH P,C
PUSHJ P,XLALL ;Fix up marks
POP P,C
POP P,T
SKIPE E,DELPGS
PUSHJ P,ADJPG
PUSHJ P,LINSET
PUSHJ P,SETWRT
POP P,A
PUSHJ P,SETWIN ;RECOMPUTE
TRO F,DSPSCR+WRITE
TRNN F,EDITM
POPJ P,
PUSHJ P,DISP ;FROM EDIT MODE - REDISPLAY NOW
JFCL
PUSH P,EDCNM ;SET TO SPACE OUT TO OLD CURSOR POS
PUSH P,[240]
MOVE D,EDPNT
ADD D,[160000,,] ;BACK UP PNTR OVER CRLF
JUMPGE D,LINED ;CONCATENATE TEXT FROM NEW LINE & RE-EDIT
SUB D,[XOR 1]
JRST LINED
;DELPM, DELPM1, DELPM2, DELPM3
DELPM: TRNE F,REDNLY+EDDIR
JRST [TLO F,PMLIN↔JRST DELL2]
LDB T,[221200,,LLDESC+LPMTXT+1(B)]
LDB TT,[341000,,LLDESC+LPMTXT+1(B)]
IMULI TT,200*5
ADDI TT,(T)
SUBI TT,1
ADDM TT,-1(P)
JUMPE T,[SOJA T,.+2]
SUBI T,200*5+1 ;# NULLS + FF
ADDM T,CHARS
ADDM T,OCHRS ;KEEP RCOMP FROM HACKING
MOVE T,LLDESC+LPMTXT(B)
TRNE T,-1
HLLM T,(T)
TRNN T,-1
MOVEM T,XPLSTE
MOVS T,T
HLRM T,(T)
HLLM T,DELPGS
TRO F,UPDIR
HRRZ A,LLDESC+LPMTXT+1(B)
SUB A,DELPGS ;PAGE #'S MAY BE WRONG UNTIL WE GET TO ADJPG
PUSHJ P,DELPAG
AOS DELPGS
SOS XPAGES
MOVSI TT,DPBIT!D1BIT
ANDCAB TT,2(A)
TLNN TT,RPMASK
JRST [PUSHJ P,FSGIVE↔JRST DELPM3]
SKIPN T,DPLST
JRST [MOVEI T,DPLST↔HRLZM T,DPLST↔JRST DELPM2]
DELPM1: MOVE TT,2(T)
CAML TT,2(A)
JRST DELPM2
HRRZ T,(T)
CAIE T,DPLST
JRST DELPM1
DELPM2: HLL T,(T)
MOVEM T,(A)
HRLM A,(T)
MOVS T,T
HRRM A,(T)
DELPM3: MOVE T,1(B)
JRST DELPR
;DELPAG, DELPG1, ADJPG, ADJPGL
DELPAG: PUSHJ P,FNDPAG
MOVEI A,(T)
DELPG1: MOVS T,(A)
MOVSI TT,DPBIT
SKIPL 2(A)
JRST .+3
HRRZM T,DIRPT
IORM TT,2(T)
HLRM T,(T)
MOVS T,T
HLLM T,(T)
HRRZ T,2(A)
MOVNI T,=12(T)
ADDM T,DIRSIZ
SOS PAGES
SOS CURPAG
TRO F,UPDIR
POPJ P,
ADJPG: HLRZ G,E
JUMPE G,CPOPJ
LDB TT,[221200,,1(G)]
ADDI T,(TT)
IDIVI T,200*5
DPB TT,[221200,,1(G)]
LSH T,34
ADDM T,1(G)
MOVNI E,(E)
ADJPGL: ADDM E,1(G)
HRRZ T,1(G)
MOVE A,[440700,,H]
MOVEI H,1
PUSHJ P,NUMSTR
MOVEM H,PMPAG-PMTXT-LPMTXT(G)
AOS T,TXTNUM
HRRM T,2-LLDESC-LPMTXT(G)
HRRZ G,(G)
JUMPN G,ADJPGL
POPJ P,
;RCOMP, RCOMP1, RCOMP2, RCOMPX
RCOMP: HLRZ T,2(G)
CAML T,ARRL
JRST RCOMP1
HRRZ G,(G)
JUMPN G,RCOMP
JRST RCOMPX
RCOMP1: MOVE T,CHARS
SUB T,OCHRS
ADDM T,XCHRS
LDB H,[221200,,1(G)]
ADDI T,(H)
IDIVI T,200*5
JUMPL TT,[ADDI TT,200*5↔SOJA T,.+1]
DPB TT,[221200,,1(G)]
LSH T,12+22
ADDM T,1(G)
JUMPE H,.+2
SUBI H,200*5
JUMPE TT,.+2
SUBI TT,200*5
SUB H,TT
ADDM H,CHARS
ADDM H,XCHRS
MOVE T,LINES
SUB T,OLINES
HRLZS T
RCOMP2: ADDM T,2(G)
HRRZ G,(G)
JUMPN G,RCOMP2
RCOMPX: MOVE T,CHARS
MOVEM T,OCHRS
MOVE T,LINES
MOVEM T,OLINES
POPJ P,
;DELETE, DELET1, ADDPAG
DELETE: MOVE A,LINES
MOVEM A,XXARRL ;Save line number at end of page in this case
MOVE A,CURPAG
AOJ A,
CAMLE A,PAGES
JRST PGERR
PUSH P,LINES
JSP B,ADDPAG
SOS CHARS ;-1 FF
POP P,T
MOVSI TT,ARRBIT!WINBIT
AND TT,BOTSTR+1
ANDCAM TT,BOTSTR+1
IORB TT,1(T)
TLNN TT,ARRBIT
JRST DELET1
TRNE TT,777
TLZ F,NULLIN
HRRZM T,ARRLIN
DELET1: TLNE TT,WINBIT
HRRZM T,WINLIN
HLLM T,(T)
MOVS T,T
HLRM T,(T)
POP P,T
ADDM T,LINES
MOVE A,CURPAG
PUSHJ P,DELPAG
PUSHJ P,FSGIVE
PUSHJ P,LINSET
PUSHJ P,SETWRT
;This code is to be put in where one returns from a page mark deletion
PUSH P,T
HLRZ T,MARKS
SUBI T,1
CAML T,CURPAG
PUSHJ P,XPSUB ;At least one mark needs attention
POP P,T
JRST WRPAGE
ADDPAG: MOVE T,PAGE
HLL T,BOTSTR
PUSH P,T
HRLM P,(T)
MOVS T,T
HRRM P,(T)
PUSH P,B
PUSHJ P,RDPAG0
HRRZ T,-1(P)
CAIN T,BOTSTR
MOVEI T,-1(P)
MOVEI TT,PAGE
HRLM TT,(T)
EXCH T,PAGE
HRRM T,-1(P)
TRO F,DSPSCR
POPJ P,
;APPEND, APPLUZ
APPEND: TRNE F,EDDIR
POPJ P,
APPEN1: PUSH P,A
MOVE T,RELPGN
CAIL T,RPMASK
JRST APPLUZ
MOVE A,CURPAG
AOJ A,
CAMLE A,PAGES
JRST PGERR
AOS XPAGES#
PUSH P,LINES
MOVE T,CHARS
PUSH P,T
IDIVI T,200*5
JUMPE TT,.+3
MOVN TT,TT
ADDI TT,200*5
PUSH P,TT
JSP B,ADDPAG
HRLM P,(T)
MOVEI B,LLDESC+LPMTXT+2
PUSHJ P,FSGET
MOVSI T,TXTCOD
HLLM T,-1(A)
POP P,T
MOVEM T,(A)
HRLM A,(T)
MOVS T,T
HRRM A,(T)
POP P,E
ADDM E,CHARS
POP P,T
SUB T,XCHRS
ADD E,T
ADDM E,XCHRS#
IDIVI T,200*5
DPB T,[121000,,TT]
HRL TT,CURPAG
MOVSM TT,LLDESC+LPMTXT+1(A)
POP P,E
AOJA E,APPEN2
APPLUZ: SORRY TOO MANY PAGES
JRST POPJ1
;APPEN2, PMTXT, PMPAG
APPEN2: ADDM E,LINES
; SKIPG XXLINE ;Are there marks on this page
; JRST .+4
; PUSH P,E
; PUSHJ P,XLALL ;Fix up marks
; POP P,E
HRLM E,LLDESC+LPMTXT+2(A)
MOVEI T,LLDESC+LPMTXT(A)
SKIPN D,XPLST
TROA D,XPLST#
HLRZ D,XPLSTE
HRLZM D,(T)
HRRM T,(D)
HRLZM T,XPLSTE#
MOVSI T,ARRBIT!WINBIT
AND T,BOTSTR+1
ANDCAM T,BOTSTR+1 ;MOVE BIT IF ARROW AT OLD END
TLO T,PMARK
MOVEM T,1(A)
TLNE T,ARRBIT
MOVEM A,ARRLIN
TLNE T,WINBIT
MOVEM A,WINLIN
AOS T,TXTNUM
MOVEM T,2(A)
ADD A,[PMTXT,,LLDESC]
MOVE B,A
BLT B,LPMTXT-1(A)
ADD A,[440700-PMTXT,,PMPAG-PMTXT]
MOVE T,CURPAG
PUSHJ P,NUMSTR
MOVE T,CHARS
MOVEM T,OCHRS#
MOVE T,LINES
MOVEM T,OLINES#
POP P,A
SOJG A,APPEN1
JRST LINSET
PMTXT: ASCID/|||||||| PAGE /
PMPAG: 1
ASCID/ ||||||||
/
LPMTXT←←.-PMTXT
;INSERT
INSERT: MOVEI B,LLDESC+LPMTXT+2
PUSHJ P,FSGET
MOVSI T,TXTCOD
HLLM T,-1(A)
MOVE T,ARRLIN
HLL T,(T)
MOVEM T,(A)
HRLM A,(T)
MOVSI TT,ARRBIT!WINBIT
AND TT,1(T)
ANDCAM TT,1(T)
TLO TT,PMARK
MOVEM TT,1(A)
MOVEM A,ARRLIN
TLNE TT,WINBIT
MOVEM A,WINLIN
MOVS T,T
HRRM A,(T)
SETZM 2(A)
ADD A,[PMTXT,,LLDESC]
MOVE B,A
BLT B,LPMTXT-1(A)
ADDI A,LPMTXT
AOS CHARS
AOS T,LINES
; SKIPLE XXLINE ;Are there line marks on this page
; PUSHJ P,XXADD ;Yes
; SKIPN G,XPLST
SOJA T,INSER6
;INSER1, INSER2, INSER3, INSER4, INSER5
INSER1: HLRZ T,2(G)
CAML T,ARRL
JRST [HLL G,(G)↔HRLM A,(G)↔JRST INSER2]
HRRZ G,(G)
JUMPN G,INSER1
MOVE G,XPLSTE
HRLZM A,XPLSTE
INSER2: HLRZ T,G
CAIN T,XPLST
JRST INSER7
HRRZ B,1(T)
HLRZ C,2(T)
INSER3: MOVEM G,(A)
HRRM A,(T)
MOVE TT,ARRL
HRLM TT,2(A)
HLRZ E,-LLDESC-LPMTXT(A)
MOVEI D,1⊗9
SUB C,ARRL
AOJGE C,INSER5
INSER4: ANDCMI D,1⊗9-1 ;AVOID CARRIES
ADDI D,@1(E)
HLRZ E,(E)
AOJL C,INSER4
INSER5: ASH D,-9
ADDM D,XCHRS
IDIVI D,200*5
HRLI B,(E)
DPB D,[341000,,B]
MOVEM B,1(A)
JUMPE E,INSER8
MOVN E,E
ADDI E,200*5
;INSER8, DIRADD
INSER8: ADDM E,XCHRS
ADDB E,CHARS
MOVEM E,OCHRS
AOS XPAGES
MOVEI E,1
MOVEI G,(A)
PUSHJ P,ADJPGL
MOVEI A,(B)
PUSHJ P,FNDPAG
PUSHJ P,DIRADD
MOVSI TT,DPBIT
AND TT,2(T)
ANDCAM TT,2(T)
JUMPE TT,.+2
HRRZM A,DIRPT
HLLM TT,2(A)
AOS CURPAG
TDO F,[PMLIN!NULLIN,,UPDIR!UPDTXT]
PUSHJ P,SETWRT
PUSHJ P,LINSET
MOVE B,ARRLIN
MOVE A,ARRL
HRLM A,LLDESC+LPMTXT+2(B) ;GOT AOSED BY RCOMP
AOJA A,SETARR
DIRADD: HRL T,(T)
MOVS T,T
DIRAD1: PUSH P,T
HRLM P,(T)
MOVS T,T
HRRM P,(T)
MOVEI B,LPDESC+1
PUSHJ P,FSGET
MOVSI T,DIRCOD
HLLM T,-1(A)
POP P,T
MOVEM T,(A)
HRLM A,(T)
MOVS T,T
HRRM A,(T)
SETZM 1(A)
MOVEI TT,2
MOVEM TT,2(A)
MOVE TT,[BYTE (7)15,12,177]
MOVEM TT,LPDESC(A)
AOS PAGES
MOVEI TT,=12+2
ADDM TT,DIRSIZ
POPJ P,
;INSER6, INSER7, MARK
INSER6: MOVEM T,OLINES
HRLZM A,XPLSTE
MOVSI G,XPLST
MOVEI T,XPLST
INSER7: MOVE B,FIRPAG
MOVEI C,
JRST INSER3
MARK: MOVE T,ARRL
MOVEM T,XXARRL ;Save original line number of marked line
PUSHJ P,INSERT
;This code is to be put in where one returns from a page mark insertion
PUSH P,T
HLRZ T,MARKS
ADDI T,1
CAML T,CURPAG
PUSHJ P,XPADD ;At least one mark needs attention
POP P,T
HRRZ A,LLDESC+LPMTXT+1(B)
JRST NEWPG0
;CONTQ
CONTQ: HLRZ B,@ARRLIN
CAIE B,PAGE
SKIPGE 1(B)
POPJ P,
HRRZ B,-1(B)
SUBI B,2
PUSHJ P,FSGET
MOVSI T,TXTCOD
HLLM T,-1(A)
HLRZ T,@ARRLIN
HRL T,ARRLIN
MOVSM T,(A)
HRRM A,(T)
HRLM A,@ARRLIN
MOVEM A,ARRLIN
AOS LINES
SKIPLE XXLINE ;Are there line marks on this page
PUSHJ P,XXADD ;Yes
MOVSI B,1(T)
HRRI B,1(A)
MOVE T,B
ADD B,-1(A)
BLT T,-1-1-2(B)
HRRZ T,1(A)
LSH T,-9
ADDM T,CHARS
CAIG T,2
TLOA F,NULLIN
TLZA F,NULLIN!PMLIN
TLZ F,PMLIN
HRRZ B,(A)
MOVSI T,ARRBIT!WINBIT
AND T,1(B)
TLNE T,WINBIT
MOVEM A,WINLIN
ANDCAM T,1(B)
HLLM T,1(A)
PUSHJ P,LINSET
PUSHJ P,SETWRT
TLNE F,NULLIN
POPJ P,
PUSH P,[0]
AOBJN P,EDIT1
JRST 4,.
;ATTACH, ATTCH1, ARGCHK, ARGCHN
PUSHJ P,ATTSRC
ATTACH: PUSHJ P,ATTDO
PUSHJ P,ATTEX
PUSHJ P,ATTCH1
HRLM G,(C)
HRRM C,(G)
MOVSI T,ARRBIT
IORB T,1(C)
TRNN T,777
TLOA F,NULLIN
TLZ F,NULLIN
MOVSI T,ARRBIT
EXCH C,ARRLIN
ANDCAM T,1(C)
SKIPN WINLIN
SETOM BOTWIN
MOVN T,ATTSIZ
ADDM T,CHARS
MOVN T,ATTNUM
ADDM T,LINES
SKIPG XXLINE ;Are there marks on this page
JRST .+4
PUSH P,T
PUSHJ P,XLALL ;Fix up marks
POP P,T
PUSHJ P,LINSET
PUSHJ P,GPAGL
MOVEM T,ATTLOC#
SETZM ATTPOS
JRST SETWRT
ATTCH1: MOVEI A,(C)
SKIPGE T,1(A)
JRST 4,.
TLZN T,WINBIT
POPJ P,
SETZM WINLIN
MOVEM T,1(A)
POPJ P,
ARGCHK: JUMPLE A,ARGCHN
MOVE T,LINES
SUB T,ARRL
CAILE A,1(T)
MOVEI A,1(T)
POPJ P,
ARGCHN: JUMPE A,CPOPJ
MOVN A,A
MOVE T,ARRL
CAILE A,-1(T)
MOVEI A,-1(T)
PUSH P,A
PUSHJ P,NMVARR
JRST POPAJ
;ATTDO, ATTDO0, ATTDO2, ATTDO1
ATTDO: TRNE F,REL
ADD A,ATTNUM
TRZE F,ATTMOD
XCT @(P)
ATTDO0: AOS (P)
PUSHJ P,ARGCHK
MOVEM A,ATTMOV#
SKIPG D,A
JRST POPAJ
SKIPE XPAGES
JRST ATTCHK
ATTOK: HLRZ G,@ARRLIN
MOVEM F,ATTFLG#
TRO F,ATTMOD
SETZM ATTSIZ
MOVEI E,ATTBUF
ATTDO2: HRRZ C,ARRLIN
ADDB A,ATTNUM
MOVEI T,(A)
CAILE T,ATTMAX
MOVEI T,ATTMAX
PUSHJ P,EXSET
ATTDO1: XCT @(P)
HRRM A,(E)
HRLM E,(A)
MOVEI E,(A)
LDB T,[111100,,1(A)]
ADDM T,ATTSIZ#
HRRZ C,(C)
SOJG D,ATTDO1
MOVEI A,ATTBUF
HRRM A,(E)
HRLM E,ATTBUF
JRST POPJ1
ATTCHK: PUSHJ P,GPAGL
HRL T,ARRL
PUSH P,T
ADDM A,ARRL
PUSHJ P,GPAGL
ANDI T,-1
POP P,TT
HLRZM TT,ARRL
CAIN T,(TT)
JRST ATTOK
SUB P,[1,,1]
OUTSTR [ASCIZ / MULTI-PAGE ATTACH NOT IMPLEMENTED.
/]
JRST POPJ1
;ATTREP, ATTEX
ATTREP: SKIPN A,ATTLOC
JRST ATTKIL
PUSH P,A
ANDI A,-1
CAME A,FIRPAG
PUSHJ P,NEWPG0
TRZN F,ATTMOD
JRST 4,. ;GET HERE IF NEWPAG FAILS
POP P,A
HLRZ A,A
PUSHJ P,SETARR
ATTEX: PUSHJ P,EXCLR
MOVEI T,
EXCH T,ATTNUM
ADDM T,LINES
SKIPG XXLINE ;Are there marks on this page
JRST .+4
PUSH P,T
PUSHJ P,XLALL ;Fix up marks
POP P,T
MOVE T,ATTSIZ
ADDM T,CHARS
MOVS T,ATTBUF
MOVE TT,ARRLIN
HLL TT,(TT)
HRLM T,(TT)
HRRM TT,(T)
MOVS T,T
MOVS TT,TT
HRRM T,(TT)
HRLM TT,(T)
ANDI T,-1
MOVSI TT,ARRBIT
IORB TT,1(T)
TRNN TT,777
TLOA F,NULLIN
TLZ F,NULLIN
MOVSI TT,ARRBIT
EXCH T,ARRLIN
ANDCAM TT,1(T)
PUSHJ P,LINSET
MOVEI B,
EXCH B,ATTLOC
SETZM ATTPOS
PUSHJ P,GPAGL
MOVE TT,ATTFLG
CAMN T,B
TRNE TT,WRITE
JRST SETWRT
TRNE F,WRITE
PUSH P,[CLRWRT]
JRST SETWRT
;ATTKIL, ATTKL, ATTSRC, GPAGL, GPAGL0, GPAGL1, GPAGL2, GPAGL3, ATTWRT
ATTKIL: TRZN F,ATTMOD
JRST ERR
PUSHJ P,EXCLR
MOVE C,ATTNUM
HRRZ A,ATTBUF
TLO F,NOCHK
ATTKL: HRRZ B,(A)
PUSHJ P,FSGIVE
MOVEI A,(B)
SOJG C,ATTKL
TLZ F,NOCHK
PUSHJ P,CORCHK
SETZM ATTLOC
SETZM ATTPOS
SETZM ATTNUM
POPJ P,
ATTSRC: TRNE F,ARG
TRNE F,REL
JUMPGE A,[AOJA A,CPOPJ]
POPJ P,
GPAGL: SKIPE TT,XPLST
JRST GPAGL1
GPAGL0: MOVE T,FIRPAG
HRL T,ARRL
POPJ P,
GPAGL1: HLRZ T,2(TT)
CAML T,ARRL
JRST GPAGL0
GPAGL2: HLRZ T,2(TT)
CAML T,ARRL
JRST GPAGL3
HRRZ TT,(TT)
JUMPN TT,GPAGL2
MOVEI TT,XPLSTE
GPAGL3: HLRZ TT,(TT)
HRLZ T,ARRL
SUB T,2(TT)
HRR T,1(TT)
POPJ P,
ATTWRT: MOVEI T,WRITE
IORM T,ATTFLG
TRO F,DSPSCR
POPJ P,
;ATTCOP, ATTCP1, ATTCP
PUSHJ P,ATTSRC
ATTCOP: MOVSI T,ATTBUF
TRNN F,ATTMOD
MOVEM T,ATTBUF
PUSHJ P,ATTDO
JRST ATTCP
PUSHJ P,ATTCP1
SKIPE A,ATTMOV
PUSHJ P,MOVARR
SKIPE T,ATTMOV
PUSHJ P,GPAGL
MOVEM T,ATTPOS#
POPJ P,
ATTCP1: SUBI C,1
MOVEM C,FSBLK
HRRZ B,(C)
SUBI B,2
PUSHJ P,FSGET
AOS C,FSBLK
MOVSI TT,-1(C)
HRRI TT,-1(A)
BLT TT,-1(T)
MOVSI TT,ARRBIT!WINBIT
ANDCAM TT,1(A)
HLRZ E,ATTBUF
HRLM A,ATTBUF
MOVEI T,ATTBUF
MOVEM T,(A)
POPJ P,
ATTCP: TRNE F,REL
JRST ATTCP0
TRNN F,ARG
MOVE A,ATTNUM
PUSHJ P,ATTEX
JRST ATTCP3
;ATTCP0, ATTCPL, ATCMOR, ATTCP2, ATTCP3, GPAGL
ATTCP0: JUMPLE A,ATTCP2
TRO F,ATTMOD
CAMN A,ATTNUM
JRST POPAJ
AOS (P)
CAML A,ATTNUM
JRST ATCMOR
MOVEI T,(A)
CAILE T,ATTMAX
MOVEI T,ATTMAX
PUSHJ P,EXSET
SUB A,ATTNUM
ADDM A,ATTNUM
PUSHJ P,GPAGL
CAMN T,ATTPOS
SKIPA T,A
MOVEI T,
MOVEM T,ATTMOV
JUMPGE A,POPJ1
MOVN C,A
MOVEI B,ATTBUF
ATTCPL: HLRZ A,ATTBUF
HLRZ T,(A)
HRRM B,(T)
HRLM T,ATTBUF
LDB T,[111100,,1(A)]
MOVN T,T
ADDM T,ATTSIZ
PUSHJ P,FSGIVE
SOJG C,ATTCPL
JRST POPJ1
ATCMOR: SUB A,ATTNUM
PUSHJ P,ARGCHK
SKIPG D,A
JRST POPAJ
MOVEM A,ATTMOV
JRST ATTDO2
ATTCP2: PUSH P,A
PUSHJ P,ATTKIL
POP P,A
ATTCP3: MOVSI T,ATTBUF
MOVEM T,ATTBUF
JRST ATTDO0
;EDIT, EDIT1, LINED, LINL1, EDDSP, EDARG, EDARGX
;HERE IS WHERE WE GIVE THE CURRENT LINE TO THE LINE EDITOR
;AND LET THE SYSTEM WORRY ABOUT IT
EDIT: PUSH P,A ;SAVE REPEAT COUNT
OUTSTR[ASCIZ /
/] ;This should answer REG's objections to no crlf's
DPB B,[70200,,C];GET BACK CONTROL BITS
PUSH P,C ;SAVE CHAR
EDIT1: MOVE D,[440700,,BUF] ;PLACE TO COPY TEXT TO
TLNE F,OFFEND+PMLIN
JRST EDNUL ;TRYING TO EDIT AT BOTTOM OF PAGE - EXTEND IT
LINED: MOVE A,[440700,,LLDESC]
ADD A,ARRLIN
LDB T,[1100,,1-LLDESC(A)]
CAIL T,40*5-2*40*5/10
JRST EDFULL
PUSHJ P,EXTST
TLNE F,NULLIN
HRLI A,350700
MOVEI DSP,EDDSP-2
MOVSI E,LSPC
MOVEI B,
LINL1: ILDB C,A ;HERE WE COPY OVER THE TEXT INTO BUF (MAINLY TO FIX TABS)
TDNE E,CTAB(C)
XCT @CTAB(C)
IDPB C,D
AOJA B,LINL1
EDDSP: JRST EDCR ;DONE WITH LINE
JRST 4,.
JRST EDTAB ;TAB - SKIP EXTRA SPACES
JRST 4,.
JRST 4,.
EDARG: IDIVI A,=10
MOVEI T,200+"0"(B)
JUMPE A,EDARGX
IDIVI A,=10
HRROI A,200+"0"(A)
TRNE A,17
IDPB A,D
ADDI B,200+"0"
IDPB B,D
EDARGX: IDPB T,D
POPJ P,
;EDFULL, EDTAB, EDNUL, EDCR, AGAIN, EDRP1, EDRPT
EDFULL: OUTSTR [ASCIZ /LINE TOO LONG FOR LINE EDITOR.
/]
SUB P,[2,,2]
JRST POPJ1
EDTAB: IDPB C,D ;COPY THE TAB
HRLS B
TLO B,-10
IBP A ;SKIP OVER THE SPACES
AOBJN B,.-1
IBP A
JRST LINL1
EDNUL: MOVEI C,15
EDCR: IDPB C,D ;END OF LINE - STORE CR
MOVEI C,12
IDPB C,D ;AND LF
MOVEI C,
IDPB C,D ;AND NULL
AGAIN: TLNE D,760000
JRST .-2 ;GET TO WORD BOUNDARY
ADD D,[430200,,1] ;SET TO NEXT WORD - MAKE IT 9 BITS
HRRZM D,PTPNT ;SAVE PNTR FOR LATER
XCT LEPREP ;DO LEYPOS NOW ON DD (SO PTLOAD WILL MAKE CORRECT TABS)
SKIPN A,EDMOV# ;Do we want to position the cursor out in the line somewhere ?
JRST EDRP0 ;No.
SETZM EDMOV
PUSHJ P,EDARG
MOVEI C,240 ;α<space>
IDPB C,D
EDRP0: POP P,C ;GET CHAR
POP P,A ;& # TIMES TO PUT IT IN
CAILE A,=200
MOVEI A,=200 ;LET'S NOT BE RIDICULOUS
JUMPLE A,EDGL ;DON'T STORE IF NONE
TRNE C,200 ;If a ctrl chr.,
PUSHJ P,EDARG ; store the repeat arg.
EDRPT: CAILE A,=99
MOVEI A,=99
IDPB C,D
SOJG A,.-1 ;STORE IT N TIMES (If we have just been to EDARG, A≤0.)
;EDGL, EDGL1, EDGL2, EDGL2A
;HERE WE ACTUALLY GIVE THE TEXT TO THE SYSTEM, FOLLOWED BY N COPIES OF THE
;INITIAL CHAR, FOLLOWED BY WHATEVER IS IN THE INPUT BUFFER WHEN WE DO IT
EDGL: MOVEI C, ;INIT CHAR TO NULL
INCHRS C ;LOOK FOR INPUT
PTLOAD [0↔BUF] ;THAT'S IT - QUICK! GET THE LINE OUT BEFORE HE TYPES MORE
CAIN C,15
INCHRS C
JRST .+2
XORI C,15≠12
IDPB C,D ;STORE THE CHAR (ALL 9 BITS) OR A NULL IF WE FINISHED
JUMPN C,EDGL ;KEEP GOING IF WE READ SOMETHING
PTWRS9 PTOUT ;OTHERWISE GIVE THE REST TO THE SYSTEM
TRO F,EDITM
SKIPLE QCHR# ;Set to 1 if an edit form of substitution command given
PUSHJ P,BSLXCT ;TRY INSERTING IT HERE
PUSHJ P,DISP ;Update display.
XCT LINTST
EDGBSL: INWAIT A ;NOW WAIT FOR IT TO COME BACK AND SEE HOW MUCH THERE IS
PUSHJ P,EXCLR
MOVEM A,EDSIZ# ;REMEMBER SIZE
MOVSI E,LSPC
MOVEI DSP,EDGDSP-2
SETZB B,TT
MOVE T,A
MOVE D,[440700,,BUF] ;WHERE TO STORE AS WE GOBBLE IT BACK
TRO F,DSPSCR
TRZA F,EDBRK
EDGL1: SOS EDSIZ
EDGL2: TTYUUO 2,C ;(a real INCHRS) ;READ CHAR - MAKE SURE THERE IS ONE
JRST [ MOVNS A ;HMMM... THE SYSTEM LIED TO US - FUDGE IT ANYWAY
ADDM A,EDSIZ ;(THIS SHOULDN'T HAPPEN, BUT IT DOES ANYWAY)
JRST EDGL3]
TRNE C,600
JRST EDACT ;ANYTHING WITH BUCKY BITS IS AN ACTIVATOR
TDNE E,CTAB(C)
XCT @CTAB(C) ;AS WELL AS SELECTED OTHER CHARS
EDGL2A: IDPB C,D
AOJ B,
SOJG A,EDGL2 ;WE THINK WE KNOW HOW MANY THERE ARE
;EDGL3, EDGL4, REEDIT, EDTMOR, EDGDSP, EDTAB2, PTOUT, PTPNT
;HERE WE HAVE FINISHED THE LINE AND NOW HAVE TO DISPATCH ON THE ACTIVATION CHAR
EDGL3: MOVEI C,15 ;TERMINATE IT IN CASE WE HAVE TO RE-EDIT
IDPB C,D
MOVEI C,
IDPB C,D
OUTSTR [ASCIZ /
/]
MOVEM D,EDPNT#
MOVEM B,EDCOLS# ;SAVE TOTAL DPY COLUMNS
MOVEM TT,EDTTBS#;& # TABS
TRZ F,ARG+REL+NEG+EDITM
HRRZ C,EDCHR ;HERE WE GO THROUGH THE COMMAND DISPATCH PROCEDURE
HRROI DSP,CMDSP
PUSHJ P,CMDEX
JRST ALTCHK
TRO F,EDITM ;FLAG THAT WE CAME FROM LINE EDIT
TLNE D,NOEDIT ;OR IF WE SHOULD GO TO THIS COMMAND IMMEDIATELY
JRST [TLNE D,DOEDIT↔PUSH P,[REEDIT]↔JRST (D)] ;DO THE CMD, MAYBE COME BACK
TLNE D,DOEDIT
JRST EDITIT ;THIS ONE WANTS TO COMPLETE THE EDIT FIRST
REEDIT: PUSH P,EDCNM ;WE DON'T LIKE THIS - EDIT IT AGAIN AT THE SAME CURSOR POS
PUSH P,[240] ;THIS SHOULD GET US THERE
EDTMOR: MOVEI C, ;IN CASE WE NEED NULLS
MOVE T,EDCOLS
PUSHJ P,EXTST
MOVE D,EDPNT
JRST AGAIN
EDGDSP: JRST EDCR2 ;SPECIAL THINGS FOR CR
JRST EDACT ;LF
JRST EDTAB2 ;TAB
JRST EDGL1 ;FF
JRST EDACT ;ALTMODE
EDTAB2: SKIPGE EDTABP
MOVEM B,EDTABP# ;REMEMBER POS OF FIRST TAB FOR REPRST
TRO B,7 ;DIDDLE COL POS
AOJA TT,EDGL2A ;& COUNT TABS
ALTCHK: TLNE D,10000 ;USER MODE SET BY JSP D,CPOPJ
JRST REEDIT
POPJ P,
IMPURE
PTOUT: 0
PTPNT: 0
PURE
;EDCR2, EDACT, EDITIT, REPLIN, PUTBAK
EDCR2: SOJLE A,.+2 ;JUST IN CASE WE'RE RUNNING OUT
TTYUUO 2,C ;GET LF (CR'S ALWAYS HAVE LF'S)
JRST 4,. ;GLEEP?
SUBI T,1(A) ;FIND CHAR POS (1 COMPENSATES FOR SOJLE)
TDCA C,[-1,,15≠12] ;MAKE IT A CR (WITH BITS FROM LF) AND AVOID NORMAL SUB
EDACT: SUB T,A ;PLAIN OLD ACTIVATION CHAR - SEE WHERE IT IS
MOVEM B,EDPOS# ;SAVE ALL KINDS OF CRAP ABOUT IT - B has horiz. position.
MOVEM T,EDCNM# ;Chr. position.
MOVEM C,EDCHR# ;Chr.
MOVEM TT,EDTBS# ;No. of tabs before it.
SOJLE A,EDGL3 ;MAYBE WE'RE DONE
TRO F,EDBRK ;NOPE - FLAG IT AS A BROKEN LINE
SETOM EDTABP ;PREPARE TO LOCATE TAB
JRST EDGL2 ;AND GET MORE
EDITIT: FOR X IN(D,A,EDCNM){PUSH P,X↔} ;COMMAND WANTS EDIT DONE - DO IT AND DISPATCH
PUSHJ P,REPLIN
POP P,EDCNM
POP P,A
POPJ P,
REPLIN: SKIPGE EDCHR ;HERE WE REPLACE THE CURRENT LINE TEXT WITH THE EDITED VERSION
SOS EDSIZ ;FUDGE FOR LF (IF PRESENT)
SOS T,EDSIZ ;AS WELL AS FOR ACTIVATION CHAR
MOVEM T,EDCNM ;A RANDOM PLACE TO SAVE IT
MOVE T,EDTTBS
LSH T,1
ADD T,EDCOLS ;# COLS + 2 * # TABS = TOTAL # CHARS WITH EXPANDED TABS
PUTBAK: TLO F,NULLIN
PUSHJ P,EDPUT ;COPY THE TEXT (SHUFFLES ASSUMING C(T) CHARS)
SKIPN EDCNM
JRST [ MOVEI C,40 ;EMPTY LINE - PUT IN A SPACE FOR DD
IDPB C,A
JRST .+1]
FOR X IN(15,12) ;TERMINATE IT
{ MOVEI C,X
IDPB C,A
} TDZA C,C
IDPB C,A
TLNE A,760000
JRST .-2 ;FLUSH ANY GARBAGE IN THE REST OF THE WORD
MOVE T,EDCNM ;# CHARS
ADDI T,2 ;ACCOUNT FOR CRLF
DPB T,[111100,,TT] ;COMBINE WITH # COLS (FROM EDPUT)
LDB C,[111100,,1(D)] ;OLD # CHARS
SUB T,C
ADDM T,CHARS ;UPDATE COUNT BY DIFFERENCE
HRRM TT,1(D)
JRST SETWRT
;EDPUT, EDPLR
;EDPUT ADJUSTS BUFFER TO TAKE C(T)+3 (CR-LF-NUL) CHARS INSTEAD OF THE CURRENT LINE,
;THEN COPIES C(EDCNM) CHARS FROM BUF, EXPANDING TABS
EDPUT: ADDI T,4+2+5*LLDESC ;<ROUND UP>+<CR-LF>+<EXTRA WDS>
IDIVI T,5 ;# WDS
TLNE F,OFFEND+PMLIN
JRST EDPLUZ ;OOPS - IT'S A PHONY LINE
EDPLR: MOVE A,ARRLIN
HRRZ B,-1(A) ;OLD # WDS
CAIN T,-2(B)
JRST EDPS
CAIL T,-2(B)
TLO F,NOCHK
MOVE B,T
PUSH P,1(A)
MOVE T,(A)
PUSH P,T
HRLM P,(T)
MOVS T,T
HRRM P,(T)
PUSHJ P,FSGIVE
TLZ F,NOCHK
PUSHJ P,FSGET
MOVSI T,TXTCOD
HLLM T,-1(A)
MOVEM A,ARRLIN
POP P,T
MOVEM T,(A)
HRLM A,(T)
MOVS T,T
HRRM A,(T)
POP P,T
MOVEM T,1(A)
TLNE T,WINBIT
MOVEM A,WINLIN
SETOM LLDESC(A)
CAIG B,LLDESC+1
JRST EDPS
MOVSI T,LLDESC(A)
HRRI T,LLDESC+1(A)
ADDI B,(A)
BLT T,-1(B)
;FALLS THRU
;EDPS, EDPL, EDPLUZ
EDPS: AOS T,TXTNUM
MOVEM T,2(A)
MOVEI D,(A)
ADD A,[440700,,LLDESC]
MOVE B,[440700,,BUF]
MOVEI TT,
SKIPN T,EDCNM
POPJ P,
TLZ F,NULLIN
EDPL: ILDB C,B
IDPB C,A
CAIE C,11 ;THE ONLY THING WE WORRY ABOUT
AOJA TT,[ SOJG T,EDPL
POPJ P,]
MOVEI C,40 ;TAB - APPEND SOME SPACES
HRLS TT
TLO TT,-10
IDPB C,A
AOBJN TT,.-1
MOVEI C,11
IDPB C,A
SOJG T,EDPL
POPJ P,
EDPLUZ: PUSH P,T ;HERE AFTER EDITING LINE N+1 (PHONY NULL LINE MADE AT EDNUL)
PUSHJ P,INSONA ;MAKE A REAL LINE
POP P,T ;RESTORE # WORDS
JRST EDPLR
;EDSNK, EDSNK2, EDSNK3, ESDSP, ESALT
EDSNK: TRO F,EDITM
PUSHJ P,DISP
XCT LINTST
TRO F,DSPSCR
MOVEI DSP,ESDSP-2
PUSHJ P,LINS1
JRST EDSNK2
INCHRW T
LSH T,-7
DPB T,[70200,,C]
EDSNK2: MOVEM C,COMCHR
TLNN F,OFFEND+PMLIN
JRST EDSNK3
PUSH P,B
PUSH P,D
PUSH P,TT
PUSHJ P,INSONA
POP P,TT
POP P,D
POP P,B
EDSNK3: PUSHJ P,LINSTO
MOVE C,COMCHR
ANDI C,577
CAIE C,415
POPJ P,
MOVEI A,1
JRST MOVARR
ESDSP: JRST POPJ1
POPJ P,
JRST LINTAB
JRST LINGLP
JRST ESALT
ESALT: SUB P,[1,,1]
MOVE A,ARRLIN
AOS T,TXTNUM
HRRM T,2(A)
POPJ P,
;CRDSP, REGCR, REGCR1, REGCR2
;FOR CR WE DISPATCH ON CONTROL BITS
CRDSP: NOEDIT!SACMD!SSCMD,,REGCR
DOEDIT!SSCMD,,CONTCR
NOEDIT!NOATT,,METACR
NOEDIT!NOATT,,DUBLCR
TLO F,OKF
REGCR: TRNN F,EDITM ;REG CR - IF EDITING
JRST REGCR1
PUSHJ P,LECR ;TAKE APPROPRIATE ACTION
JRST REGCR2 ;NO - JUST MOVE
PUSH P,D
PUSHJ P,REPRST
POP P,D
PUSH P,[1]
PUSH P,[311] ;SET UP INSERT MODE FOR NEW LINE
JRST EDTMOR
REGCR1: AOS (P)
REGCR2: TRNE F,ATTMOD
JRST MOVARR
MOVE B,ARRL ;HERE WE'RE JUST MOVING - SEE WHERE TO
CAMLE B,LINES
JUMPG A,INSONE ;GOING OFF THE BOTTOM - ADD A LINE
JRST MOVARR ;OK - JUST MOVE IT
;CONTCR, CNTCR2, METACR, REPRST, REPRS2
PUSHJ P,CNTCR2
CONTCR: TRNE F,EDITM
POPJ P,
SKIPN A,SRCOFF
JRST POPJ1
HRRZM A,EDMOV
MOVEI A,
JRST EDIT
CNTCR2: MOVE D,[EDOK*10,,EDIT]
MOVEI A,
POPJ P,
METACR: TRNE F,EDITM
PUSHJ P,LECR ;DO LINE EDIT STUFF IF NECESSARY
JRST INSONE ;NOT MIDDLE OF LINE - JUST ADD BLANK LINE
REPRST: MOVN T,EDCNM ;HERE WE STORE THE REST OF THE LINE AFTER THE ACTIVATOR
ADDM T,EDSIZ ;BY UPDATING ALL THE PARAMS BY THE AMOUNT ALREADY DONE
AOSG T,EDTABP
JRST REPRS2
SOS TT,T ;HERE WE FUDGE FOR THE TAB WHOSE POSITION
SUB TT,EDPOS ;(AND HENCE SIZE) IS CHANGING (SIGH)
ORCMI T,7
ORCMI TT,7
SUB T,TT
REPRS2: SUB T,EDPOS
ADDM T,EDCOLS
MOVN T,EDTBS
ADDM T,EDTTBS
JRST REPLIN
;LECR, DUBLCR, DUBCR2
;HERE WE HANDLE ALL FLAVORS OF CR FROM THE LINE EDITOR
;IF IT'S AT THE END WE JUST REPLACE THE TEXT AND RETURN
;IF IT'S IN THE MIDDLE WE REPLACE UP TO THE BREAK, MAKE A NEW LINE,
;MOVE THE REMAINING TEXT DOWN IN BUF, AND SKIP RETURN
LECR: TRNN F,EDBRK ;MIDDLE OF LINE?
JRST [ PUSH P,A
PUSHJ P,REPLIN ;NO - REPLACE WHOLE LINE
POP P,A
POPJ P,] ;& RETURN
AOS (P) ;TELL CALLER WE'RE SPLITTING A LINE
MOVE T,EDTBS
LSH T,1 ;2 TABS/TAB
ADD T,EDPOS
PUSH P,C
PUSHJ P,PUTBAK ;PUT FIRST PART BACK
PUSH P,B
MOVEI A,1
PUSHJ P,MOVARR ;TO THE NEXT LINE
PUSHJ P,INSONA ;AND MAKE A NEW ONE
POP P,B
MOVE D,[440700,,BUF]
ILDB C,B ;COPY REST OF TEXT DOWN WHERE REPLACER EXPECTS IT
IDPB C,D
JUMPN C,.-2
POP P,C
POPJ P,
DUBLCR: TRNN F,EDITM
JRST DUBCR1
PUSHJ P,LECR
JRST DUBCR3
TRZ F,EDITM+EDBRK
PUSH P,A
PUSHJ P,REPRST ;PUT THE REST BACK
POP P,A
DUBCR1: TRNN F,ARG
JRST LININS ;NO ARG -ENTER LINE INSERT MODE
DUBCR2: MOVNS A ;INVERT SENSE OF ARROW MOVING
JRST INSNUL ;ARG GIVEN - INSERT N BLANK LINES
DUBCR3: TRNE F,ARG
JRST DUBCR2
MOVEI A,1
PUSHJ P,MOVARR
JRST LININS
;INSONA, INSONE, INSNUL, INSNLP
;INSNUL INSERTS |C(A)| NULL LINES BEFORE (+) OR AFTER (-) THE ARROW
INSONA: SKIPA A,[-1]
INSONE: MOVEI A,1
INSNUL: MOVM D,A ;# TO INSERT
JUMPE D,CPOPJ
PUSH P,A
ADDM D,LINES
SKIPG XXLINE ;Are there marks on this page
JRST .+4
PUSH P,D
PUSHJ P,XLALL ;Fix up marks
POP P,D
PUSHJ P,LINSET ;# LINES HAS CHANGED
MOVEI B,(D)
LSH B,1
ADDM B,CHARS
MOVSI T,WINBIT
SKIPE A,WINLIN
ANDCAM T,1(A)
SETZM WINLIN
MOVEI B,LLDESC+1
MOVSI C,TXTCOD
MOVSI E,ARRBIT
MOVE G,[ARRBIT,,2000]
MOVE H,[ASCID/
/]
INSNLP: PUSHJ P,FSGET
HLLM C,-1(A)
MOVE T,ARRLIN
HLL T,(T)
MOVEM T,(A)
HRLM A,(T)
ANDCAM E,1(T)
MOVS T,T
HRRM A,(T)
MOVEM A,ARRLIN
MOVEM G,1(A)
AOS T,TXTNUM
MOVEM T,2(A)
MOVEM H,LLDESC(A)
SOJG D,INSNLP
PUSHJ P,SETWRT
MOVE A,TOPWIN
SKIPL (P)
ADD A,(P) ;MOVE WINDOW INSTEAD OF ARROW
PUSHJ P,SETWIN ;RECOMPUTE
POP P,A ;ORIGINAL ARG
JUMPGE A,MOVARR
TLO F,NULLIN
TLZ F,PMLIN
POPJ P,
;LININS, LINSLP, LINS1, LINGLP, LIDSP, LINTAB
LININS: MOVEI T,"↔"
DPB T,[10700,,ARRON]
MOVEM F,FSAV#
TLZ F,TF1
LINSLP: PUSHJ P,INSONA
TRO F,EDITM
PUSHJ P,DISP
XCT LINTST
MOVEI DSP,LIDSP-2
PUSHJ P,LINS1
JRST LINCOM
JRST LINSLP
POPJ P,
LINS1: MOVSI E,LSPC
SETZB B,TT
SETOM BUF
MOVE T,[BUF,,BUF+1]
BLT T,BUF+37
MOVE D,[440700,,BUF]
LINGLP: INCHWL C
TRNE C,600
POPJ P,
TDNE E,CTAB(C)
XCT @CTAB(C)
IDPB C,D
AOJA B,LINGLP
LIDSP: JRST LINCR1
POPJ P,
JRST LINTAB
JRST LINGLP
JRST LINALT
LINTAB: IDPB C,D
SUB TT,B
HRLS B
TLO B,-10
MOVEI T,40
IDPB T,D
AOBJN B,.-1
IDPB C,D
ADDI TT,1(B)
JRST LINGLP
;LINCR1, LINCR, LICCR, LINALT, LINCOM
LINCR1: INCHRW T
CAIN T,212
JRST LICCR
LINCR: PUSHJ P,LINST1
MOVEI A,1
PUSHJ P,MOVARR
JRST POPJ1
LICCR: MOVEI T,"→"
DPB T,[10700,,ARRON]
MOVEI T,2
ADDM T,(P)
JRST LINSTO
LINALT: SUB P,[1,,1]
MOVEI T,"→"
DPB T,[10700,,ARRON]
JUMPN B,LINSTO
MOVEI A,1
TRZ F,EDITM
PUSHJ P,DELLIN
TLZE F,TF1
POPJ P,
MOVE T,FSAV
TRNN T,WRITE
JRST CLRWRT
POPJ P,
LINCOM: MOVEM C,COMCHR ;DO THIS CMD LATER
MOVEI T,"→"
DPB T,[10700,,ARRON]
;FALL INTO LINSTO
;LINSTO, LINST1
LINSTO: MOVEI C,15
LINST1: TLO F,TF1+NULLIN
JUMPE B,[MOVEI T,40↔IDPB T,D↔AOJA TT,.+2]
TLZ F,NULLIN
IDPB C,D
MOVEI C,12
IDPB C,D
LDB E,[370300,,D]
MOVEI T,-BUF+1(D)
TDZA C,C
IDPB C,D
TLNE D,760000
JRST .-2
IMULI T,5
SUB T,BTAB(E)
SUB T,TT
MOVEI TT,-2(T) ;ACCOUNT FOR OLD CRLF
ADDM TT,CHARS
EXCH B,D
MOVEI B,-BUF+1+LLDESC(B)
DPB T,[111100,,D]
HRRZ A,ARRLIN
HLL D,1(A)
MOVE T,(A)
PUSH P,T
HRLM P,(T)
MOVS T,T
HRRM P,(T)
TLO F,NOCHK
PUSHJ P,FSGIVE
TLZ F,NOCHK
PUSHJ P,FSGET
MOVSI T,TXTCOD
HLLM T,-1(A)
MOVEM A,ARRLIN
POP P,T
MOVEM T,(A)
HRLM A,(T)
MOVS T,T
HRRM A,(T)
MOVEM D,1(A)
TLNE D,WINBIT
MOVEM A,WINLIN
AOS T,TXTNUM
MOVEM T,2(A)
ADD A,[BUF,,LLDESC]
ADDI B,-LLDESC(A)
BLT A,-1(B)
;SETWRT, SETWR2, SETWRX, BTAB, BUF, RBUF
SETWRT: SKIPE G,XPLST
PUSHJ P,RCOMP
TRO F,DSPSCR
MOVE H,WFLAG
TRO F,WRITE
TLO H,"W"⊗13
TRNE F,FILLUZ
JRST SETWR2
MOVE T,CHARS
CAMLE T,ROOM
JRST [ TRO F,XPAGE
TLO H,"X"⊗4
JRST SETWR2]
TRZ F,XPAGE
TLZ H,3760
SETWR2: HLRZ T,@ARRLIN
CAIN T,PAGE
TLOA T,PMARK
MOVE T,1(T)
TLNE T,PMARK
TROA F,UPDTXT
TRNE F,UPDIR+UPDTXT
TRO H," D"⊗1
SETWRX: CAMN H,WFLAG
POPJ P,
MOVEM H,WFLAG
MOVEM H,WFLAG2
MOVE G,SCRTOP
HLLZS DPYTAB(G)
POPJ P,
BTAB: 0↔@↔5↔3↔1↔@↔4↔2
;FRD, FRD0, FRD1, NOEXT, NOPRG, NOPPN, NOSWIT, SWITL
;Use with caution because of AOS (P)
FRD: SETZM (D)
SETZM 1(D)
SETZM 2(D)
; MOVEI T,1
; MOVEM T,SPAGE ;In case no page # is specified.
; MOVEM T,SLINE
MOVE T,PPN
MOVEM T,3(D)
MOVSI T,'DSK'
MOVEM T,-1(D)
SETZM 4(D)
FRD0: TLZ F,TF1
TLZ D,1740
PUSHJ P,GETNAM
JUMPN A,FRD2 ;Was a name given?
TLNE F,ZATT ;No but is an ε or λ command to be flushed?
PUSHJ P,EPSIL4 ;Yes. This also replaces PUSHJ which will be POP'ed.
FRD2: CAIN C,":"
JRST SETDEV
JUMPE A,FRD1
MOVEM A,(D)
TLO D,40
TLNE D,200000
SETZM 1(D)
FRD1: CAIE C,"."
JRST NOEXT
PUSHJ P,GETNAM
HLLZM A,1(D)
TLO D,100
NOEXT: CAIE C,"["
JRST NOPP2
PUSHJ P,GETP
JUMPE A,.+3
HRLM A,3(D)
TLO D,200
CAIE C,","
JRST NOPRG
PUSHJ P,GETP
JUMPE A,NOPRG
HRRM A,3(D)
TLO D,400
NOPRG: CAIE C,"]"
JRST NOPPN
PUSHJ P,TYI
JFCL ;used to be JRST FRDX, which didn't initialize flags, page & line.
NOPPN: TLNE D,200000
TLNN D,1740
JRST SWLOP
NOPP1: SETOM SLINE
SETOM SPAGE
HLLZS CREASW
SETZM RDONLY
IFN BOOKMD, {
SETZM BOOKSW
};END BOOKMD
SETZM QUIETF
SETZM 4(D)
MOVSI T,'DSK'
TLNN D,1040
MOVEM T,-1(D)
SWLOP: CAIN C,"("
JRST SWITL
CAIN C,"/"
JRST SWIT1
FRDX:
PUSH P,C
PUSHJ P,ZLIST
POP P,C
CAIN C,","
JRST ZLCMA
CAIE C,15
CAIN C,";"
JRST POPJ1
CAIE C,"←"
CAIN C,"→"
AOS (P)
POPJ P,
NOPP2: TLNE D,200000
TLNN D,40
JRST NOPPN
MOVE T,PPN
MOVEM T,3(D)
JRST NOPP1
SWIT1: PUSHJ P,DOSWIT
NOSWIT: PUSHJ P,TYI
JRST FRDX
JRST SWLOP
SWITL: PUSHJ P,DOSWIT
CAIN C,")"
JRST NOSWIT
TLNE T,FSPC
JRST SWLOP
JRST SWITL
ZLCMA: ;FOOL ZSAVE INTO SAVING PAGE NUMBERS TYPED IN AS SWITCHES
MOVE A,SPAGE
MOVE T,SLINE
EXCH A,CURPAG
EXCH T,ARRL
PUSH P,A ↔ PUSH P,T
PUSHJ P,ZSAVE
POP P,T ↔ POP P,A
EXCH A,CURPAG
EXCH T,CURPAG
JRST FRD
;SETDEV, GETNAM, GETNML, GETP, GETPL, DTYI1, DTYI, DTYI2
SETDEV: MOVEM A,-1(D)
TLO D,1000
JRST FRD0
;ACCUMULATE LEFT-ADJUSTED SIXBIT. FROM TTY. TO A.
GETNAM: MOVE B,[440600,,A] ;ACCUMULATE SIXBIT IN A
MOVEI A,0
GETNML: PUSHJ P,DTYI ;GET A CHARACTER
POPJ P, ;SOME SORT OF DELIMITER
SUBI C,40 ;MAKE IT SIXBIT
TLNE B,770000
IDPB C,B ;STUFF SIXBIT UNLESS OVERFLOWING
JRST GETNML ;GATHER MORE
;ACCUMULATE RIGHT ADJUSTED SIXBIT. FROM TTY. TO A.
GETP: MOVEI A, ;ACCUMULATE IN A.
GETPL: PUSHJ P,DTYI ;GOBBLE.
POPJ P, ;DELIMITER SEEN
TRNE A,770000 ;FULL YET?
JRST GETPL ;YES. WAIT FOR DELIM
LSH A,6 ;MAKE ROOM
IORI A,-40(C) ;ADD THIS CHARACTER
JRST GETPL ;LOOP
DTYI1: TLCA F,TF1 ;TOGGLE ESCAPE FLAG
DTYIS: JUMPN A,CPOPJ
DTYI: PUSHJ P,TYIU ;READ TTY OR RESCANNED DATA
POPJ P, ;NONE LEFT
CAIN C,"↓" ;TOGGLE ESCAPE MODE?
JRST DTYI1 ;YES. DO IT
TLNE F,TF1 ;IN ESCAPE MODE?
JRST DTYI2 ;YES. NEARLY ANYTHING GOES.
TLNE T,FSPC ;IS CHARACTER A SPECIAL?
POPJ P, ;YES. RETURN IT
CAIE C,11
CAIN C,40
JRST DTYIS ;IGNORE SPACES AND TABS
DTYI2: CAIGE C,40 ;LEGAL?
TLZ F,TF1 ;NO! CLEAR QUOTE MODE FLAG.
JRST POPJ1 ;RETURN THIS AS LEGAL CHARACTER
;DOSWIT, NTYI, NTYIL, NTYIM, EDFIL, EDFIL2, SRCFIL, DSTFIL
DOSWIT: PUSHJ P,NTYI
JUMPL D,CPOPJ
CAIN C,"L"
MOVEM A,SLINE#
CAIN C,"P"
MOVEM A,SPAGE#
CAIN C,"N"
HRLOM D,4(D)
CAIN C,"R"
SETCAM A,RDONLY#
CAIN C,"Q"
SETCAM A,QUIETF#
CAIN C,"Z" ;TEMP PAGE,LINE HACK
JRST [ MOVEM A,SPAGE# ↔ MOVEM B,SLINE# ↔ JRST .+1 ]
CAIN C,"C"
SETCAM A,CREASW#
IFN BOOKMD, {
CAIN C,"B"
SETCAM A,BOOKSW#
SKIPE BOOKSW
SETOM RDONLY ;BOOKSW IMPLIES RDONLY ALSO
};END BOOKMD
POPJ P,
NTYI: MOVEI A,
NTYIL: PUSHJ P,TYIU
POPJ P,
TLNN T,NUMF
JRST NTYIM
IMULI A,12
ADDI A,-"0"(C)
JRST NTYIL
NTYIM: JUMPN A,NTYICM
CAIE C,"-"
JRST NTYICM
PUSHJ P,NTYIL
MOVN A,A
JUMPN A,NTYICM
MOVNI A,1
NTYICM: CAIE C,","
POPJ P,
PUSH P,A ;, MEANS WE HAVE X OF X,Y IN A. SAVE IT AND GET Y
PUSHJ P,NTYI
MOVE B,A
POP P,A
POPJ P,
;- CAUSES NTYI TO CALL ITSELF FOR |NUMBER|. COMMA CAUSES CALL TO SELF FOR Y OF X,Y
IMPURE
0
EDFIL: BLOCK 6
0
EDFIL2: BLOCK 6
0
SRCFIL: BLOCK 5
0
DSTFIL: BLOCK 5
PURE
;RSCAN, RSCAN0, RSCAN1, RSCAN2, RSCAN3, RSCAN4, RSCN4B, RSCN4C, RSCN4A, RSCN0A
;CALLED FROM BEG0. RESCAN TTY.
; RETURNS RSPNT,TYIPNT, AND SYSCMD
; TYIPNT = BYTE POINTER TO FILE NAME PORTION OF COMMAND LINE.
; SYSCMD = SIXBIT COMMAND NAME (2 LETTERS) FOR EDITOR COMMANDS
RSCAN: RESCAN T ;RESCAN TTY (HERE AT NORMAL START)
JUMPLE T,CPOPJ ;NOTHING THERE?
;ENTER HERE FOR DEBUGGER (DON'T DO RESCAN, SET T INFINITE)
RSCAN0: PUSHJ P,RSTYI1 ;READ CHARACTER FROM TTY. UPPER CASE
POPJ P, ;NONE THERE
SOJLE T,CPOPJ ;DECREMENT COUNT. RETURN IF RUN OUT
CAIE C," "
CAIN C,11
JRST RSCAN0 ;IGNORE LEADING BLANKS AND TABS
MOVE A,[440700,,BUF] ;INITIALIZE BYTE POINTER
IFE BOOKMD, {
CAIE C,"R" ;IN BOOKMD, HAVE TO ACCEPT "READ" SYSTEM COMMAND
};END ¬BOOKMD
CAIN C,"S"
JRST RSCAN3 ;S OR START COMMAND
MOVEI B,-40(C) ;CONVERT CHARACTER TO SIXBIT
PUSHJ P,RSTYI1 ;GET ANOTHER CHARACTER
POPJ P,
IFN BOOKMD, {
CAIN B,'R'
CAIN C,"E"
JRST RSCN0A ;STARTED BY ETV, CETV, OR READ COMMANDS
MOVEI TT,RSCAN3+1 ;R OR RUN COMMAND
JRST RSTYI0
RSCN0A:
};END BOOKMD
SOJLE T,CPOPJ
SUBI C,40 ;CONVERT TO SIXBIT
DPB B,[60600,,C] ;SAVE FIRST SIXBIT CHARACTER.
PUSHJ P,SYSCCK ;CHECK TWO RIGHT ADUSTED SIXBIT CHRS
JRST RSCAN6 ;CEtv, ETv, EDit, CReate, or REad COMMAND
RSCAN1: TLNN T,-1 ;DON'T UNDERSTAND. COMMAND. FLUSH!
INCHRS C ;(IF T>777777 THEN RETURN NOW!
POPJ P,
RSCAN2: SOJG T,RSCAN1 ;read in and ignore rest of faulty command
RSCANX: SETZM SYSCMD
SETZM RSPNT
POPJ P,
;HERE IF SYSTEM START/RUN COMMAND SEEN. READ TO ";" THEN READ FILE NAME.
RSCAN3: JSP TT,RSTYI ;GET NEXT. WE SAW A MONITOR RUN COMMAND
JRST RSCAN2 ;WAS CR
SOJG T,RSCN4D ;WAS ";" READ FILE NAME NEXT
SOJG T,RSCAN3 ;WAS LEGAL, IGNORE IT
POPJ P, ;(RAN OUT OF TEXT)
;HERE TO GOBBLE FILE NAME. STOW IT USING "A" AS A BYTE POINTER
RSCN4D: MOVEM A,RSPNT ;POINTER TO FIRST BYTE OF FILE NAME.
RSCAN4: JSP TT,RSTYI ;GOBBLE TEXT
JRST RSCAN5 ;CR ENDS SCAN
SOJG T,RSCAN8 ;FLUSH AFTER SEMI-COLON
RSCN4B: IDPB C,A ;STOW TEXT
SOJG T,RSCAN4 ;GOBBLE MORE TEXT
JRST RSCANX ;UNEXPECTED END OF DATA, ACT UNHAPPY
;AT RSCN4A TO FLUSH BLANKS AND TABS BEFORE SCANNING NAMES.
RSCN4C: JSP TT,RSTYI
JRST RSCAN5 ;CR SEEN
SOJG T,RSCAN8 ;SEMI-COLON SEEN. FLUSH THE REST. BE HAPPY.
RSCN4A: CAIE C," " ;IGNORE BLANKS AND TABS
CAIN C,11
SOJG T,RSCN4C ;IGNORE BLANKS AND TABS
MOVEM A,RSPNT ;SOME NON-BLANK SEEN
JRST RSCN4B ;SET POINTER AND GOBBLE TEXT
;RSCAN5, RSCAN6, RSCAN7, RSCAN8, SYSCCK, CRECHK
RSCAN5: IDPB C,A ;CR SEEN. STOW IT
INCHRS C ;GET LF
JRST RSCANX
SOJLE T,RSCANX ;VARIOUS WAYS TO BE UNHAPPY
CAIE C,12
JRST RSCANX
IDPB C,A ;STOW LF AND NULL
MOVEI C,
IDPB C,A
TLNN T,-1 ;SKIP IF T>777777 (NOT RESCAN)
SOJG T,RSCAN1 ;IF THERE'S MORE, UNHAPPY
MOVE A,[440700,,BUF]
MOVEM A,TYIPNT ;SET UP POINTER TO TEXT
POPJ P, ;RETURN HAPPY
;HERE WHEN EDIT COMMAND SEEN.
RSCAN6: LSH C,6 ;MOVE COMMAND TO L.ADJ IN RIGHT HALF
HRLZM C,SYSCMD ;SAVE 6BIT COMMAND LEFT ADJUSTED
RSCAN7: JSP TT,RSTYI ;GOBBLE
JRST RSCAN5 ;END OF TEXT. ACT HAPPY. (E.G., "ET<CR>")
SOJG T,RSCAN8 ;SEMICOLON MEANS COMMENT HERE
CAIL C,"A"
CAILE C,"Z"
JRST RSCN4A ;SOME NON-LETTER SEEN. GOBBLE FILE NAME
SOJG T,RSCAN7 ;FLUSH UNTIL A DELIMITER SEEN
JRST RSCANX
;FLUSH INPUT THROUGH CR. ";" SEEN AFTER FILE NAME SCAN BEGAN.
RSCAN8: JSP TT,RSTYI
JRST RSCAN5 ;CR SEEN. BE HAPPY
SOJG T,RSCAN8
SOJG T,RSCAN8
JRST RSCANX
SYSCCK: CAIE C,'ET'
CAIN C,'ED'
POPJ P,
IFN BOOKMD, {
CAIN C,'RE'
POPJ P,
};END BOOKMD
CRECHK: CAIE C,'CE'
CAIN C,'CR'
POPJ P,
JRST POPJ1
;RSTYI, TYI1, TYI2, TYI3, TYIX, TYI4
;READ TTY. RETURN CHARACTER IN C.
;RETURN +1 ON CR, +2 ON ";" AND +3 ON OTHERS,
; EXCEPT, NO DATA RETURNS TO RSCANX, ILLEGAL CHAR RETURNS TO RSCAN2
RSTYI: PUSHJ P,RSTYI1
JRST RSCANX
IFN BOOKMD, {
RSTYI0:
};END BOOKMD
CAIN C,15
JRST (TT)
CAIN C,";"
JRST 1(TT)
CAIN C,11
JRST 2(TT)
CAIE C,"→"
CAIN C,"↓"
JRST 2(TT)
CAIL C,40
TRNE C,600
JRST RSCAN2
JRST 2(TT)
;READ TTY, SKIP RETURN UPPER CASE ONLY IN "C".
RSTYI1: INCHRS C
POPJ P,
AOS (P)
UCASE: CAIGE C,"a"
POPJ P,
CAIG C,"z"
SUBI C,"a"-"A"
POPJ P,
TYI1: SKIPE C,TYICHR#
JRST TYI3
SKIPE TYIPNT
JRST TYI4
TYI2: INCHWL C
CAIE C,15
JRST TYIX
INCHWL C
TRCA C,15≠12
TYI3: SETZM TYICHR
TYIX: MOVEM C,TYISV#
POPJ P,
TYI4: ILDB C,TYIPNT
JUMPN C,TYIX
SETZM TYIPNT
SKIPN TYIINS#
JRST TYIX
XCT TYIINS
SETZM TYIINS
JRST TYIX
;TYI, TYIT, TYIU
;Use with caurion because of skip return
TYI: PUSHJ P,TYI1
TYIT: TRNE C,600
POPJ P,
HLL T,CTAB(C)
TLNN T,LSPC!NSPEC
JRST POPJ1
JUMPE C,TYI
PUSH P,T
MOVN T,CTAB(C)
HRLI T,400000
LSH T,(T)
TLNN T,744000
AOS -1(P)
POP P,T
POPJ P,
TYIU: PUSHJ P,TYI
POPJ P,
TLNE T,LETF
TLNN T,LT2F
JRST POPJ1
SUBI C,40
JRST POPJ1
;TMPRED, TMPRD1, TMPRD2, TMPRDX, RPGRD1, BKPRED
TMPMAX←←37
;TCBUF←←BUF2
TMPRED: MOVE T,[1,,['ED '↔-TMPMAX,,TCBUF-1]]
IFN BOOKMD, {
SKIPE BOOKSW ;use different tmpcor filename in /B mode
MOVE T,[1,,['BK '↔-TMPMAX,,TCBUF-1]]
};END BOOKMD
TMPCOR T, ;SEEK TMPCOR FILE
JRST RPGRED ;NONE. TRY TO READ QQSVED.RPG
TMPRDY: JUMPLE T,CPOPJ ;NO DATA?
CAILE T,TMPMAX ;OVERFLOW?
POPJ P, ;YES. THAT'S TOO MUCH WORK.
SETZM TCBUF(T) ;MAKE SURE WE STOP.
MOVE T,[440700,,TCBUF]
TMPRD1: MOVE G,T ;G←POINTER TO BYTE BEFORE THE FIRST REAL CHARACTER.
ILDB C,T ;GET A CHARACTER
CAILE C,40 ;DELIM?
JRST TMPRD2 ;NO. REAL.
JUMPN C,TMPRD1 ;LOOP UNTIL A REAL CHARACTER IS SEEN.
POPJ P, ;BUT IF THERE AREN'T ANY, WE QUIT
TMPRD2: ILDB C,T ;NOW, WE SKIP UNTIL WE SEE SOME REAL STUFF.
CAIG C,40 ;REAL CHARACTER?
JRST TMPRDX ;NO. WE HAVE SKIPPED THE ET OR CET PART.
JUMPN C,TMPRD2 ;WHILE WE'RE STILL IN BUSINESS...
POPJ P, ;OOPS.
TMPRDX: MOVEM T,TYIPNT ;THIS POINTS TO THE ARGUMENT PORTION.
MOVEM T,TCPNT ;(G POINTS TO THE COMMAND NAME)
JRST POPJ1 ;INDICATES WE WON.
RPGRED: MOVE T,[['DSK '↔'QQSVED'↔'RPG '↔0↔0],,LKUP-1]
IFN BOOKMD, {
SKIPE BOOKSW ;LOOK FOR DIFFERENT RPG FILE IN /B MODE
MOVE T,[['DSK '↔'QQBKP '↔'RPG '↔0↔0],,LKUP-1]
};END BOOKMD
MOVEI C,DSKI
PUSHJ P,OPNDEV ;NOTE THAT OPNDEV SKIPS ON FAILURE
LOOKUP DSKI,LKUP
JRST RELDEV
IFN BOOKMD, {
RPGRD1: ;BKPRED (SEE BELOW) ENTERS HERE TO READ .BKP FILE
};END BOOKMD
INPUT DSKI,[-TMPMAX,,TCBUF-1↔0]
PUSHJ P,RELDEV
MOVS T,LKUP+3
MOVN T,T ;SET UP POSITIVE WORD COUNT
JRST TMPRDY
IFN BOOKMD, {
BKPRED:
TLNN D,740 ;FILENAME SPECIFIED?
JRST BKPRD0 ;NO, LOOK FOR .BKP FILE
SKIPG SLINE ;YES. /#L OR /#P SPECIFIED?
SKIPLE SPAGE ;
JRST BKPRD1 ;YES. IGNORE .BKP FILE
SKIPE RDONLY ;/R SPECIFIED?
JRST BKPRD1 ;YES. IGNORE .BKP FILE
BKPRD0: MOVE T,[['DSK '↔0↔'BKP '↔0↔0],,LKUP-1]
MOVEI C,DSKI
PUSHJ P,OPNDEV
SKIPN T,EDFIL ;LOOK FOR .BKP FILE WITH SAME FIRST NAME AS BOOK FILE
JRST BKPRD2 ;RELEASE DSK. (SHOULD NEVER BE HERE)
MOVEM T,LKUP ;USE EDIT FILE'S NAME FOR .BKP FILE
MOVE T,EDFIL+3 ;PICK UP PPN FROM COMMAND
JSP TT,BKPLKP ;LOOKUP .BKP FILE ON PPN GIVEN IN COMMAND
MOVE T,PPN ;NOT FOUND. TRY AGAIN ON USER'S CURRENT AREA
JSP TT,BKPLKP
MOVE T,RPPN ;NOT FOUND. TRY AGAIN ON USER'S LOGGED IN PPN
JSP TT,BKPLKP
JRST BKPRD2 ;NOT FOUND THERE EITHER
BKPLKP: MOVEM T,BKPPPN# ;SAVE PPN OF .BKP FILE
MOVEM T,LKUP+3
LOOKUP DSKI,LKUP
JRST (TT) ;DIRECT RETURN ON FAILURE
PUSHJ P,RPGRD1 ;READ IN FILE AND SCAN PAST "ET" PART. RELEASE DSK.
JRST BKPRD1 ;ILLEGAL FORMAT, IGNORE .BKP FILE
MOVEI D,EDFIL2
PUSHJ P,FRD ;GET FILENAME FROM .BKP FILE
JRST BKPRD1 ;ILLEGAL FORMAT, IGNORE .BKP FILE
MOVE T,BKPPPN ;GET PPN OF .BKP FILE
TLNN D,600 ;DID .BKP FILE SPECIFY A PPN?
MOVEM T,EDFIL2+3 ;NO. USE .BKP FILE'S PPN FOR ACTUAL BOOK FILE
MOVE T,[EDFIL2-1,,EDFIL-1]
BLT T,EDFIL+5 ;NO. MAKE FILENAME FROM .BKP FILE THE FILE TO EDIT
; HLLOS NEWBKP ;SET FLAG INDICATING USE OF .BKP FILE
POPJ P,
BKPRD2: PUSHJ P,RELDEV ;NO .BKP FILE FOUND
SETZM BKPPPN
TLNE D,740 ;WAS A FILENAME SPECIFIED?
SETOM NEWBKP# ;YES, FLAG TO TELL USER WE WILL CREATE A .BKP FILE
TLNN D,740 ;WAS A FILENAME SPECIFIED?
BKPRD1: SETZM BKPSW ;NO. DON'T WRITE .BKP FILE
POPJ P,
};END BOOKMD
;TMPWRT, BKPWRT
TMPWRT: SKIPN SYSCMD
POPJ P,
SETZM TCBUF
MOVE T,[TCBUF,,TCBUF+1]
BLT T,TCBUF+TMPMAX-1
MOVE T,[440700,,TCBUF]
MOVEM T,TYOPNT
TYPCHR "ET"
TYPCHR " "
MOVEI D,EDFIL
PUSHJ P,FILSTR
SKIPE PAGE
TDZA T,T
MOVEI T,1
PUSH P,TYOPNT
TYPCHR "("
IFN BOOKMD, {
SKIPE BOOKSW
TYPCHR "B"
};END BOOKMD
SKIPE RDONLY
TYPCHR "R"
XCT (T)[SKIPN DIRPAG↔SKIPE EDFIL+4]
TYPCHR "N"
XCT (T)[SKIPA TT,CURPAG↔SKIPGE TT,SPAGE]
JRST .+3
TYPDEC TT
TYPCHR "P"
XCT (T)[SKIPA TT,ARRL↔SKIPGE TT,SLINE]
JRST .+3
TYPDEC TT
TYPCHR "L"
LDB T,TYOPNT
TYPCHR ")"
POP P,TT
CAIN T,"("
MOVEM TT,TYOPNT
TYPCHR "
"
MOVE T,TYOPNT
IFN BOOKMD, {
SETZ C, ;MAKE SURE LOSING 4 BITS ARE ZERO ANYWAY (DISK DUMP MODE FEATURE)
};END BOOKMD
IFE BOOKMD, {
TDZA C,C
};END ¬BOOKMD
IDPB C,T
TLNE T,760000
JRST .-2
MOVNI TT,-TCBUF+1(T)
MOVSI TT,(TT)
HRRI TT,TCBUF-1
MOVSI T,'ED '
IFN BOOKMD, {
SKIPE BOOKSW ;USE DIFFERENT TMPCOR FILENAME IN /B MODE
MOVSI T,'BK '
};END BOOKMD
MOVE A,[3,,T]
TMPCOR A,
JFCL
POPJ P,
IFN BOOKMD, {
BKPWRT: PUSH P,TT ;SAVE DUMP MODE OUTPUT COMMAND
MOVE T,[['DSK '↔0↔'BKP '↔0↔0],,ENTR-1]
MOVEI C,RPGO
PUSHJ P,OPNDEV
JRST BKPWR2 ;DSK OPENED
BKPWR1: SUB P,[1,,1] ;CANT OPEN DISK OR CANT ENTER .BKP FILE
JRST RELDEV
BKPWR2: MOVE T,EDFIL ;PICK UP PRIMARY NAME OF FILE BEING EDITED
MOVEM T,ENTR ;AND USE IT FOR .BKP FILE'S PRIMARY NAME
MOVE T,BKPPPN ;REMEMBER WHAT DISK AREA THE .BKP FILE IS TO BE ON
MOVEM T,ENTR+3
ENTER RPGO,ENTR ;MAKE <FILENM>.BKP FILE
JRST BKPWR1
POP P,T ;RETRIEVE DUMP MODE COMMAND
SETZ TT,
OUTPUT RPGO,T
MOVE T,CURPAG
CAME T,PAGES ;ARE WE ON THE LAST PAGE OF THE BOOK?
JRST RELDEV ;NO
CLOSE RPGO, ;YES, DELETE .BKP FILE
SETZM ENTR
MOVE T,BKPPPN
MOVEM T,ENTR+3
RENAME RPGO,ENTR ;HIE THEE AWAY
JFCL
JRST RELDEV
};END BOOKMD
;FILERR, FILTYP, FILSTR, PPNTYP, FILETB
FILERR: MOVE T,ZINDEX
SETZM ZDATA(T) ;Prepare to overwrite bad data
HRRE T,1(D)
CAIGE T,NFLERS
SKIPA TT,FILETB(T)
MOVEI TT,[ASCIZ \UNRECOGNIZED LOOKUP/ENTER ERROR: \]
OUTSTR (TT)
SETZM TYOPNT
MOVE A,-1(D)
HLRZ T,TT
JUMPN T,(T)
FILTYP: SETZM TYOPNT
FILSTR: MOVE A,-1(D)
CAMN A,['DSK ']
JRST .+3
PUSHJ P,SIXTYO
TYPCHR ":"
FILST2: MOVE A,(D)
PUSHJ P,SIXTYO
HLLZ A,1(D)
JUMPE A,PPNTYP
TYPCHR "."
PUSHJ P,SIXTYO
PPNTYP: SKIPE A,3(D)
CAMN A,PPN
POPJ P,
TYPCHR "["
HLLZS A
PUSHJ P,PNTYO
TYPCHR ","
HRLZ A,3(D)
PUSHJ P,PNTYO
TYPCHR "]"
POPJ P,
[ASCIZ /DEVICE NOT DISK: /]
SIXTYO,,[ASCIZ /DEVICE CAN'T BE OPENED: /]
FILETB: [ASCIZ /FILE NOT FOUND: /]
PPNTYP,,[ASCIZ /USER NOT FOUND: /]
[ASCIZ /PROTECTION FAILURE: /]
[ASCIZ /FILE IN USE: /]
NFLERS←←.-FILETB
;SIXTYO, SIXTYL, SIXTY2, SIXTYN, SIXTNL, SIXTNN, PNTYO, PNTYOL
SIXTYO: MOVE B,[440600,,A]
SIXTYL: ILDB C,B
JUMPE C,SIXTYN
SIXTY2: TYPCHR 40(C)
TLNE B,770000
JRST SIXTYL
POPJ P,
SIXTYN: MOVEI T,1
SIXTNL: TLNN B,770000
POPJ P,
ILDB C,B
JUMPN C,SIXTNN
AOJA T,SIXTNL
SIXTNN: TYPCHR "_"
SOJG T,.-1
JRST SIXTY2
PNTYO: JUMPE A,CPOPJ
MOVE B,[440600,,A]
ILDB C,B
JUMPE C,.-1
PNTYOL: JUMPN C,.+2
MOVEI C,"_"-40
TYPCHR 40(C)
TLNN B,500000
POPJ P,
ILDB C,B
JRST PNTYOL
;UUOH, UUODSP, UFCE, UTYPCH, UTYPC2, UTYPDE, UTYPOC
UUOH: PUSH P,T
LDB T,[331100,,40]
CAIG T,NUUOS
SKIPGE T,UUODSP(T)
JRST 4,.
EXCH T,(P)
POPJ P,
UUODSP: -1
UUOS{,U!X
}
UFCE: HRRZ T,40
CAIN T,T
SKIPA T,-1(P)
MOVE T,(T)
POPJ P,
UTYPCH: EXCH T,40
ROT T,-7
TRNE T,177
PUSHJ P,UTYPC2
ROT T,7
PUSHJ P,UTYPC2
MOVE T,40
POPJ P,
UTYPC2: SKIPN TYOPNT
OUTCHR T
SKIPE TYOPNT
IDPB T,TYOPNT#
POPJ P,
UTYPDE: PUSHJ P,UTYPR
POPJ P,12
UTYPOC: PUSHJ P,UTYPR
POPJ P,10
FOOZ←<XTTYUU> ↔ GOOZ←<TTYUUO>
UXTTYU: PUSH P,A ;All TTYUUO's (INCHRW, etc.) now come here...
MOVSI A,(<GOOZ≠FOOZ>) ;Change it to a real TTYUUO
MACTYX: XORB A,40
JRST MACTYI
HOOZ←<SNEAKW> ↔ IOOZ←<CALLI 400063>
USNEAK: PUSH P,A ;SNEAKW now comes here.
MOVE A,[HOOZ≠IOOZ]
XORB A,40
LDB A,[POINT 4,A,12]
JRST MACTYI
;UTYPR, UTYPR1, USORRY, UFATAL
UTYPR: PUSH P,T
HRRZ T,@-1(P)
MOVEM T,RADIX#
PUSHJ P,UFCE
PUSHJ P,UTYPR1
POP P,T
POPJ P,
UTYPR1: PUSH P,TT
IDIV T,RADIX
JUMPE T,.+2
PUSHJ P,UTYPR1
MOVEI T,"0"(TT)
PUSHJ P,UTYPC2
POP P,TT
POPJ P,
USORRY: OUTSTR [ASCIZ /
SORRY -- /]
OUTSTR @40
OUTSTR [ASCIZ / /]
POPJ P,
UFATAL:
SETOM TELFL2# ;Want message reproduced
PUSHJ P,FBI ;Notify ALS of details
PPSEL
OUTSTR [ASCIZ /
FATAL ERROR -- /]
OUTSTR @40
OUTSTR [ASCIZ /
/]
JRST 4,UFATAL
;OPENI, OPNOI, IOPEN, SETI, SETRLD, OPNDEV, RELDEV, OPNLUZ
;Note possible skip return
OPENI: TLZ F,ENTRD
SKIPA C,[DSKI]
OPNOI: MOVEI C,DSKO
DPB C,[270400,,%LKUP]
DPB C,[270400,,%IN]
DPB C,[270400,,%SETI]
DPB C,[270400,,%STAT]
MOVEM C,ICHN#
MOVEI T,(C)
XORI T,DSKI≠DSKO
DPB T,[270400,,%RELS]
XCT %RELS
SETZM JOBJDA(T)
IOPEN: MOVSI T,-1(D)
HRRI T,LKUP-1
PUSHJ P,OPNDEV
XCT %LKUP
POPJ P,
SETZM IBLK
MOVS T,LKUP+3
MOVNM T,FILWC#
ASH T,-7
MOVNM T,FILLEN#
HLLZ T,LKUP+2
TLZ T,37
; IOR T,DATBLK ;MUST FIX ****** FOR ACCTIM NOT DSKTIM
MOVEM T,2(D)
LDB T,[POINT 12,DATBLK,17] ;Get 12 low ordeer bits of date
DPB T,[POINT 12,2(D),35]
LDB T,[POINT 11,DATBLK,35] ;Now the time in minutes
DPB T,[POINT 11,2(D),23]
HRRZ T,LKUP+1
HRRM T,1(D)
LDB T,[POINT 3,DATBLK,5] ;But don't forget the 3 high order bits
DPB T,[POINT 3,1(D),20]
AOS (P)
SETI: TRZ F,EOF
MOVE T,IBLK
CAIN T,-1(A)
JRST SETI2
HRRZM A,IBLK#
SOS IBLK
XCT %SETI
SETI2: HLLZ T,A
ROT T,7
ADD T,IBFPNT
MOVEM T,NEWPNT#
SETRLD: MOVE T,[440700,,IBFE]
HRRZM T,ABFEND ;SET UP ADDRESS OF THE END OF THE BUFFER.
MOVEM T,INPNT#
POPJ P,
IMPURE
%OPEN: OPEN OPNBLK
%RELS: RELEAS
%LKUP: LOOKUP LKUP
%IN: IN [-200,,IBUF-1↔0]
%SETI: USETI (A)
%STAT: GETSTS C
%CSTAT: CHNSTS TT
OPNBLK: 17↔0↔0
IBFPNT: 10700,,IBUF-1
0
LKUP: BLOCK 4
PURE
;Note possible skip return
OPNDEV: MOVE TT,T
BLT TT,3+1(T)
CAMLE C,JOBHCU↑
JRST .+3
SKIPGE JOBJDA↑(C)
POPJ P,
DPB C,[270400,,%CSTAT]
XCT %CSTAT
TRNE TT,400000
POPJ P,
DPB C,[270400,,%OPEN]
MOVE TT,(T)
MOVEM TT,OPNBLK+1
XCT %OPEN
JRST [HLLOS 1+1(T)↔JRST POPJ1]
MOVEI TT,(C)
DEVCHR TT,
TLNE TT,DVDSK
POPJ P,
MOVEI TT,-2
HRRM TT,1+1(T)
AOS (P)
RELDEV: DPB C,[270400,,%RELS]
XCT %RELS
SETZM JOBJDA(C)
POPJ P,
OPNLUZ: PUSH P,A
MOVEI D,LKUP
PUSHJ P,FPAUSE
OUTSTR [ASCIZ /LOOKUP./]
MOVSI D,EDFIL
POP P,A
SOS (P)
JRST IOPEN
;RLD, RLD1, RLD2, RLDX, RLDLUZ, FIXEOF, ENTLUZ, ENTL2
;HERE IF WE FOUND A RUBOUT IN THE INPUT FILE.
;USUALLY THIS MEANS WE'RE AT END OF RECORD, BUT IT MAY HAVE BEEN
;A RUBOUT FROM THE FILE ITSELF.
;CALLING SEQUENCE IS:
; ILDB C,BADR
; SKIPG CTAB(C)
; XCT @CTAB(C) ;SUBJECT INSTRUCTION IS: PUSHJ P,RLD
RLD: MOVE C,(P) ;CALLER'S ADDRESS.
HRRZ C,@-3(C) ;ADDRESS PART OF BYTE POINTER
CAME C,ABFEND# ;IS THIS THE LAST WORD OF THE BUFFER?
JRST [AOS RLDRUB#↔POP P,C↔JRST -3(C)]
;NO. WAS R-O FROM FILE. RETURN AND IGNORE.
XCT %IN ;TIME TO READ MORE. (IN UUO)
RLD1: AOSA C,IBLK ;COUNT A BLOCK READ
JRST RLDLUZ ;HERE WE HAVE EOF OR ERROR (IN UUO SKIPPED)
CAMN C,TSTBLK#
PUSHJ P,@TSTSET#
RLD2: MOVE C,IBFPNT
EXCH C,NEWPNT ;FANCY NEW POINTER WILL NEXT TIME BE NORMAL
RLDX: EXCH C,(P) ;STORE POINTER SO
POP P,@-3(C) ;THE POP CLOBBERS THROUGH THE ILDB
JRST -3(C) ;RETURN TO THE ILDB
RLDLUZ: XCT %STAT ;GET STATUS (INTO C)
TRNN C,20000 ;EOF?
JRST 4,. ;NO. BARF. SOME REAL ERROR
MOVE C,IBLK ;GET THE NUMBER OF SUCCESSFULLY READ BLOCKS
LSH C,7 ;LAST SUCCESSFULLY READ WORD
CAMGE C,FILWC ;BIGGER THAN FILE WORD COUNT?
JRST FIXEOF ;NO. WE HAVE JUST READ A PARTIAL BUFFER.
TROE F,EOF ;SET FLAG FOR EOF
JRST RLD2 ;WE WERE THROUGH HERE BEFORE.
MOVE C,[BYTE (7)14] ;PUT FF WHERE WE'LL SEE IT
MOVEM C,IBUF
MOVEI C,1 ;NOW ARRANGE FOR SOME RUB OUTS
JRST FIXEF1
FIXEOF: SUB C,FILWC
MOVN C,C
FIXEF1: PUSH P,IBFE
POP P,IBUF(C)
MOVEI C,IBUF(C)
MOVEM C,ABFEND ;SET END OF BUFFER'S ADDRESS
JRST RLD1
ENTLUZ: PUSH P,A
PUSH P,D
MOVEI D,ENTR
PUSHJ P,FPAUSE
OUTSTR [ASCIZ /ENTER./]
MOVEI C,DSKO
PUSHJ P,RELDEV ;STUPID SYSTEM!
LDB T,[270400,,%LKUP]
CAIE T,DSKO
JRST ENTL2
MOVE A,IBLK
MOVEI D,EDFIL
PUSHJ P,IOPEN
PUSHJ P,OPNLUZ
ENTL2: POP P,D
POP P,A
MOVEI E,EDFIL
JRST OPENO
;Here we check to see if it is really safe to complete the formatting of the
;file being loaded.
RLDCHK:
SETZM TYOPNT
MOVE T,RLDRUB
JUMPN T,RLDCK2
MOVE T,SOSBIN
SUB T,SOSPAG
SUB T,SOSLIN
JUMPN T,RLDCK3
OUTSTR [ASCIZ /
You are formatting a normal SOS file with /]
TYPDEC SOSPAG
OUTSTR [ASCIZ / pages and /]
TYPDEC SOSLIN
OUTSTR [ASCIZ / lines./]
POPJ P,
RLDCK2: OUTSTR [ASCIZ /
This file has /
TYPDEC RLDRUB
OUTSTR [ASCIZ / RUBOUT symbols and is probably an XGP file.
Do you really want to edit it and wipe these all out? (Y or N) /]
RLDASK: PUSHJ P,YESCHK
POPJ P,
SUB P,[1,,1]
JRST FNF2
RLDCK3: OUTSTR [ASCIZ /
This looks like a binary file that would be hopelessly garbaged by formatting.
Do you really want to do it (Y or N)? /]
JRST RLDASK
;EXTCHK, EXTCH1, EXTCH2, EXTCH3, EXTCH4, EXTTAB
EXTCHK: HRRZ T,LKUP+1
JUMPN T,POPJ1
MOVE T,@SRCFIL+3
MOVEM T,OBUF
MOVSI T,'UFD'
MOVEM T,OBUF+1
MOVE T,['1 1']
MOVEM T,OBUF+3
MOVE T,SRCFIL
TLNN T,100
LOOKUP DSKI,OBUF
JRST POPJ1
MOVNS T,OBUF+3
MOVE B,@SRCFIL
MOVEI C,-1
EXTCH1: MOVN T,OBUF+3
JUMPGE T,EXTCH4
CAMGE T,[-200,,]
MOVSI T,-200
ADDM T,OBUF+3
HRRI T,IBUF-1
MOVE A,T
MOVEI TT,
INPUT DSKI,T
EXTCH2: CAME B,1(A)
JRST EXTCH3
HLRZ T,2(A)
MOVSI TT,-NEXTS
CAIE T,@EXTTAB(TT)
AOBJN TT,.-1
CAILE C,(TT)
SKIPGE EXTTAB(TT)
JRST EXTCH3
MOVEI C,(TT)
HRLZM T,@SRCFIL+1
EXTCH3: ADD A,[4,,4]
JUMPL A,EXTCH2
JRST EXTCH1
;Note skip return
EXTCH4: CAIL C,-1
AOS (P)
MOVSI T,400000
HLLM T,SRCFIL+1
POPJ P,
EXTTAB: FOR X IN(FAI,SAI,F4,PUB,MAC,LSP,LAP,PAL,WRU,NSA,OSA,LST,CMD,TXT,RELX,<DMPX>
,XGPX,DRWX,WD X,PC X,WPCX,PLTX,PCPX,PLXX,WL X,WLSX)
{ (<SIXBIT /X/>)
}NEXTS←←.-EXTTAB
0
;OPENW, OPENO, SETO, FPAUSE, PAUSE, PAUS2
OPENW: TRNN F,REDNLY
TLOE F,ENTRD
JRST OPENO2
LDB TT,[270400,,%LKUP]
CAIE TT,DSKO ;ONLY DO RENAME IN ALTER MODE
JRST OPENO
PUSHJ P,OPENO
MOVE T,3(E)
MOVEM T,ENTR+3
; MOVE T,DATBLK ;MUST FIX ******
; DPB T,[2700,,ENTR+2]
LDB T,[POINT 12,DATBLK,17]
DPB T,[POINT 12,ENTR+2,35]
LDB T,[POINT 3,DATBLK,5]
DPB T,[POINT 3,ENTR+1,20]
LDB T,[POINT 11,DATBLK,35] ;Now the time in minutes
DPB T,[POINT 11,ENTR+2,23]
RENAME DSKO,ENTR
OUTSTR [ASCIZ /RENAME TO SET WRITTEN TIME FAILED.
/]
POPJ P,
OPENO: MOVSI T,-1(E)
HRRI T,ENTR-1
MOVEI C,DSKO
PUSHJ P,OPNDEV
ENTER DSKO,ENTR
JRST ENTLUZ
SETZM OBLK#
OPENO2: PUSHJ P,WRBF1
MOVE T,[OBUF-1,,OBUF]
TLNN F,CLRBF ;ALREADY DONE?
BLT T,OBUF+177
POPJ P,
SETO: HRRZM A,OBLK
USETO DSKO,(A)
JRST WRBF2
FPAUSE: HRRE T,1(D)
JUMPGE T,PAUSE
PUSHJ P,PAUSE
OUTSTR [ASCIZ /OPEN./]
POPJ P,
PAUSE: SKIPN DPY
JRST PAUS2
PUSH P,G
PUSH P,SCRSIZ
PUSHJ P,FINI2
POP P,SCRSIZ
POP P,G
PPACT 200000 ;Select PP1
PTWR1W [0↔10000+"N"] ;ONLY WAY TO NORMALIZE PP
PAUS2: SETZM TYOPNT
TYPCHR 15*200+12
PUSHJ P,FILERR
OUTSTR [ASCIZ /
Type CONTINUE to retry /]
XCT @(P)
EXIT 1,
JRST POPJ1
;CLOSO, WRBUF, WRBF1, WRBF2, ENTR, OBUF
CLOSO: MOVE D,OPNT
CAMN D,[700,,OBUF-1]
POPJ P,
TDZA T,T
IDPB T,D
TLNE D,760000
JRST .-2
HRLI D,1(D)
ADDI D,2
CAMG D,[OBUF+177,,OBUF+200]
SETZM -1(D)
CAMGE D,[OBUF+177,,OBUF+200]
BLT D,OBUF+177
WRBUF: OUT DSKO,[-200,,OBUF-1↔0]
WRBF1: AOSA OBLK
JRST 4,.
WRBF2: PUSH P,T
MOVEI T,200*5
MOVEM T,OCNT#
MOVE T,[700,,OBUF-1]
MOVEM T,OPNT#
MOVE T,[OBUF-1,,OBUF]
TLNE F,CLRBF
BLT T,OBUF+177
POP P,T
POPJ P,
IMPURE
0
ENTR: BLOCK 4
0 ;FOR BLT
OBUF: BLOCK 200
IBUF: BLOCK 200
IBFE: -2
PURE
;MORCOR, INTLUZ, INTDSP, PDLOV, PDLOV1, PDLOV2, PDLOV3, ISAV, TSINT, TSNINT
TSINT: MOVEM T,ISAV ;HERE FOR INTERRUPT (OLD DEC STYLE)
MOVEM TT,ISAV+1 ;SAVE SOME AC'S
MOVE T,JOBCNI ;THIS IS THE REASON WE'RE HERE
JFFO T,.+1 ;CONVERT BIT NUMBER TO INDEX (WHOOPEE!)
CAIL TT,MININT ;IN RANGE?
CAILE TT,MAXINT
INTLUZ: JRST 4,. ;UNEXPECTED TYPE OF INTERRUPT
JRST 2,@INTDSP-MININT(TT) ;DISPATCH TO PARTICULAR INTERRUPT SERVER
INTDSP: PDLOV
INTLUZ
INTLUZ
MORCOR
MAXINT←←.-INTDSP+MININT
TSNINT: MOVE T,JBICNI ;FIGURE OUT WHY WE WERE INTED
TLNE T,4 ;SHOULD BE ESC I
SETOM ESCIEN
DISMIS ;OH WELL
IMPURE
JBICNI: 0 ;THIS THREE CONSECUTIVE WORDS USED INSTEAD OF .JBCNI, TPC, AND APR
JBITPC: 0 ;FOR NEW INTS (I.E. ESC I INTS)
JBIAPR: TSNINT ;GO TO TSNINT FOR NEW STYLE INTS
ESCIEN: 0 ;NON ZERO WHEN SEARCH SHOULD GRIND TO A HALT
PURE
IFND: MOVEM TT,IFRET#
IFND1: CAIL T,BEG
CAMLE T,JOBREL
JRST IFND3
IFND2: MOVE T,(T)
MOVEM T,INTINS#
MOVE T,ISAV
MOVE TT,ISAV+1
MOVEI T,@INTINS
HLRZ TT,INTINS
ANDI TT,777000
CAIN TT,(<XCT>)
JRST IFND1
LDB TT,[270400,,INTINS]
CAIE TT,T
CAIN TT,TT
ADDI TT,ISAV-T
MOVEM TT,IFACP#
HLRZ TT,INTINS
ANDI TT,¬37
AOS IFRET
JRST @IFRET
IFND3: CAMLE T,JOBHRL↑
JRST @IFRET
JRST IFND2
PDLOV: SKIPE SFSPNT
JSP SBARF
TLNN P,-1
CAMLE P,JOBREL
JRST TRYPSH
HLRZ T,(P)
ANDI T,357637
CAIE T,310000
CAIN T,10000
JRST PDLOV2
TRYPSH: SOS T,JOBTPC
JSP TT,IFND
JRST PDLUNK
ANDI TT,777000
CAIE TT,(<PUSH>)
PDLUNK: JRST 4,.
MOVE T,@IFACP
HLRZ T,(T)
JUMPN T,PDLUNK
MOVN TT,[1,,1]
ADDM TT,@IFACP
JRST INTERR
PDLOV2: SUB P,[1,,1]
HRRZ T,1(P)
SUBI T,1
JSP TT,IFND
AOBJP P,TRYPSH
CAIN TT,(<PUSHJ P,>)
CAIE T,@JOBTPC
AOBJP P,TRYPSH
SOS T,1(P)
MOVEM T,JOBTPC
JRST INTERR
IMPURE
ISAV: BLOCK 3
PURE
;FSINI, FSINI1, MORCOR
FSINI: MOVE T,JOBREL
CAMLE T,JOBFF
JRST FSINI1
ADDI T,2000
CORE T,
JRST 4,.
MOVE T,JOBREL
FSINI1: AOJ T,
MOVEM T,FSMAX#
SUB T,JOBFF
HRROM T,@JOBREL
HRROM T,@JOBFF
MOVEM T,FSFREE#
MOVE T,JOBFF
MOVEM T,FSMIN#
MOVEM T,FSBEG#
SETZM FSUSE#
POPJ P,
MORCOR: HRRZ T,JOBTPC ;HERE FOR ILL MEM REF
MOVSI TT,-LEGCNT
CAME T,LEGTAB(TT) ;IS INTERRUPT PC= TO ONE OF LEGAL VALUES?
AOBJN TT,.-1
JUMPGE TT,INTERR ;JUMP IF NOT A MEMBER OF LEGTAB
MOVE T,JOBREL ;LET'S GET MORE CORE.
ADDI T,2000
CAILE T,377777 ;MAKE SURE WE DON'T GET TOO BLOATED
JRST [OUTSTR [ASCIZ/I JUST GOT TOO BLOATED.
/]
HALT MORCOR]
CORE T,
JRST 4,. ;(BARF)
;REG 1/1/74 TO FIX AC OF PUSH THAT GOT ILM
LDB T,[POINT 9,@JOBTPC,8] ;GET OP CODE
CAIE T,(<PUSH>⊗-9) ;IS THIS A PUSH?
JRST INTX ;NO. EXIT NOW.
MOVE T,@JOBTPC ;GET LOSING PUSH.
HRRI T,ISAV ;CHANGE ADDRESS PART TO CLOBBER USELESS CELL
TLC T,(<PUSH>≠<POP>) ;CHANGE PUSH TO A POP
MOVEM T,ISAV+2 ;SAVE IT WHERE WE'LL XCT IT.
MOVE T,ISAV
MOVE TT,ISAV+1
XCT ISAV+2 ;RESTORE T AND TT, THEN FIX THE PUSH AC
JRST 2,@JOBTPC
INTX: MOVE T,ISAV
MOVE TT,ISAV+1
JRST 2,@JOBTPC
INTERR: MOVE T,JOBENB↑
MOVEI TT,
APRENB TT,
SLEEP TT,
MOVEM T,JOBENB
JRST INTX
;FSGET, FSLUP0, FSLUP, FSGRAB, FSXIT
FSGET: TSTSHF
MOVEI T,2(B)
CAMLE T,FSFREE
SOJA T,FSNEW
MOVEI TT,
MOVE A,FSBEG
FSLUP0: SKIPL T,(A)
JRST FSUSED
FSLUP: SKIPL T,(A)
JRST FSNEXT
CAIG B,-2(T)
TRNN T,-2
JRST FSTSML
FSGRAB: HRRZ TT,T
ADDI T,(A)
CAIN B,-2(TT)
JRST FSXIT
SUBI TT,2(B)
HRROM TT,-1(T)
SUBI T,(TT)
HRROM TT,(T)
MOVEI TT,2(B)
FSXIT: CAMN A,FSBEG
HRRZM T,FSBEG
MOVEM TT,-1(T)
MOVEM TT,(A)
ADDM TT,FSUSE
MOVNS TT
ADDM TT,FSFREE
AOJA A,CPOPJ
;FSNEWT, FSNEWP, FSNEW
FSNEWT: MOVEI T,1(B)
FSNEWP: POP P,D
POP P,C
FSNEW: MOVE TT,FSMAX
SKIPGE -1(TT)
SUB TT,-1(TT)
ADDI T,(TT)
CAMLE T,JOBREL
CALLI T,11
JRST 4,.
MOVE A,FSMAX
SKIPGE T,-1(A)
SUBI A,(T)
MOVE T,JOBREL
AOJ T,
MOVE TT,T
SUB TT,FSMAX
ADDM TT,FSMAX
ADDM TT,FSFREE
SUBI T,(A)
HRROM T,(A)
HRROM T,@JOBREL
JRST FSGRAB
;FSUSED, FSTSML, FSNEXT, FSHRET, FSLLUZ
FSUSED: ADDI A,(T)
MOVEM A,FSBEG
JRST FSLUP0
FSTSML: CAIL TT,(T)
JRST FSNEXT
HRRZ TT,T
MOVEM A,FSBIG#
FSNEXT: ADDI A,(T)
CAMGE A,FSMAX
JRST FSLUP
JUMPE TT,[JRST 4,.]
MOVEI T,40(B)
TLNN F,NOSHUF
CAMLE T,FSFREE
SOJA T,FSNEW
PUSH P,C
PUSH P,D
SUBI TT,2(B)
MOVE A,FSBIG
PUSHJ P,FSLSCN
JRST FSLLUZ
MOVEI T,2(B)
LSHC C,-2
CAML C,T
SOJA T,FSNEWP
LSHC C,2
PUSHJ P,FSLSHF
FSHRET: POP P,D
POP P,C
JRST FSGRAB
FSLLUZ: MOVEI T,100(B)
CAMLE T,FSFREE
SOJA T,FSNEWP
PUSHJ P,FSLSHF
MOVNI TT,2(B)
PUSHJ P,FSHSCN
JRST FSNEWT ;NO CAN DO - SOMETHING MUST BE LOCKED
MOVEI T,2(B)
LSH C,-1
CAML C,T
SOJA T,FSNEWP
PUSHJ P,FSHSHF
JRST FSHRET
;FSLSCN, FSLSCL, FSLFR, FSLSHF, FSLSLP, FSLMOV, FSLDON
FSLSCN: MOVEI C,
FSLSCL: CAMGE A,FSBEG
POPJ P,
MOVE T,-1(A)
SUBI A,(T)
SKIPGE T,(A)
JRST FSLFR
TLNE T,LOKBIT
JRST [ADDI A,(T)↔POPJ P,] ;CAN'T MOVE IT
ADDI C,(T)
JRST FSLSCL
FSLFR: ADDI TT,(T)
JUMPL TT,FSLSCL
JRST POPJ1
FSLSHF: CAMG A,FSBEG
ADDM C,FSBEG
MOVEI C,
FSLSLP: CAML A,FSBIG
JRST FSLDON
SKIPL T,(A)
JRST FSLMOV
SUBI C,(T)
ADDI A,(T)
JRST FSLSLP
FSLMOV: HRRZS T
PUSHJ P,PNTREL
PUSHJ P,FSBLT
ADDI A,(T)
JRST FSLSLP
FSLDON: CAML A,FSMAX
TDZA T,T
HRRZ T,(A)
MOVE TT,T
ADDI TT,-1(A)
SUB T,C
HRROM T,(TT)
ADD A,C
HRROM T,(A)
POPJ P,
;FSHSCN, FSHSCL, FSHFR, FSHSHF, FSHSLP, FSHSR, FSHMOV
FSHSCN: MOVEI C,
FSHSCL: SKIPGE T,(A)
JRST FSHFR
TLNE T,LOKBIT
JRST [HRRZ T,-1(A)↔SUBI A,(T)↔POPJ P,] ;CAN'T MOVE
ADDI C,(T)
FSHSC2: ADDI A,(T)
CAMGE A,FSMAX
JRST FSHSCL
POPJ P,
FSHFR: ADDI TT,(T)
JUMPL TT,FSHSC2
JRST POPJ1
FSHSHF: MOVEI C,
FSHSLP: SKIPL T,(A)
JRST FSHMOV
ADDI C,(T)
FSHSR: CAMG A,FSBIG
JRST FSHSX
MOVE T,-1(A)
SUBI A,(T)
JRST FSHSLP
FSHSX: SKIPN T,C
POPJ P, ;JUST IN CASE
ADDI C,-1(A)
HRROM T,(C)
HRROM T,(A)
CAMGE A,FSBEG
MOVEM A,FSBEG
POPJ P,
FSHMOV: ANDI T,-1
PUSHJ P,PNTREL
PUSHJ P,FSBLT
JRST FSHSR
;FSBLT, POPTJ, FSBLT1
;MOVES (T) WORDS LOCATED AT (A) A DISTANCE OF (C). CLOBBERS D & TT
FSBLT: CAILE T,(C)
JUMPGE C,FSBLT1
JUMPLE T,CPOPJ
MOVE TT,A
ADD TT,C
HRL TT,A
PUSH P,T
ADDI T,(TT)
BLT TT,-1(T)
POPTJ: POP P,T
POPJ P,
FSBLT1: CAILE C,5
JRST FSBLT2
JUMPE C,CPOPJ
PUSH P,B
PUSH P,E
MOVSI E,377777(T)
HRRI E,(A)
ADD E,T
MOVSI B,(<POP E,(E)>)
HRRI B,(C)
MOVE C,[JUMPL E,B]
MOVE D,[JRST .+2]
SOJA E,B
HRRZ C,B
POP P,E
POP P,B
POPJ P,
;FSBLT2, FSBLT3, FSHBLT, FSHBL2
FSBLT2: HRRM C,FSHBLT
SOS FSHBLT
HRLS C
MOVE D,A
ADDI D,(C)
PUSH P,T
IDIVI T,(C)
MOVE T,(P)
ADD T,A
HRLS T
ADDI T,(C)
JUMPE TT,FSBLT3
HRRM TT,FSHBL2
SOS FSHBL2
HRLS TT
SUBB T,TT
XCT FSHBL2
FSBLT3: SUB T,C
MOVE TT,T
XCT FSHBLT
CAIGE D,(T)
JRST FSBLT3
HRRZS C
JRST POPTJ
IMPURE
FSHBLT: BLT TT,(T)
FSHBL2: BLT TT,(T)
PURE
;PNTREL, SHFTB, STDSH1, STDSHF, RELOC, RELOCL
;Note skip return
PNTREL: CAMN A,FSBLK#
JRST [ ADDM C,FSBLK
ADDM C,FSBL2#
JRST .+1]
HLRZ TT,(A)
CAIL TT,MXSHF
JRST 4,.
MOVE D,A
ADD D,T
HLRZ D,-1(D)
SKIPN C
AOSA (P)
PUSHJ P,@SHFTB(TT)
HRRZ T,(A)
POPJ P,
DEFINE SHFCOD!(X){X!COD←←.-SHFTB X!SHF}
SHFTB: STDSHF
SHFCOD DIR
SHFCOD TXT
MXSHF←←.-SHFTB
STDSH1: HLRZ T,D
PUSHJ P,RELOC
ANDI D,-1
STDSHF: JUMPN D,STDSH1
POPJ P,
LSTSHF: MOVE T,1(A)
LSTSH1: MOVSI C,(C)
PUSHJ P,RELOCL
MOVS T,T
HLRE C,C
RELOC: SKIPA TT,(T)
RELOCL: HLRZ TT,(T)
CAIE A,-1(TT)
JRST 4,.
ADDM C,(T)
POPJ P,
;FSGIVE, FSGIV1, FSGIV2
FSGIVE: CAMGE A,FSMAX
CAMGE A,FSMIN
JRST 4,.
PUSH P,A
PUSH P,B
HRROS TT,-1(A)
SOS B,A
ADDI B,(TT)
HRROS -1(B)
MOVNI TT,(TT)
ADDM TT,FSUSE
MOVN TT,TT
ADDM TT,FSFREE
CAMLE A,FSMIN
SKIPL T,-1(A)
JRST FSGIV1
SUBI A,(T)
ADDI TT,(T)
HRROM TT,(A)
ADDI T,(A)
HRROM TT,-1(B)
FSGIV1: CAMGE B,FSMAX
SKIPL T,(B)
JRST FSGIV2
ADDI TT,(T)
HRROM TT,(A)
ADDI B,(T)
HRROM TT,-1(B)
FSGIV2: CAMGE A,FSBEG
MOVEM A,FSBEG
TLNN F,NOCHK
PUSHJ P,CORCHK
JRST POPBAJ
;CORCHK, CRUNCH, CMPACT
CORCHK: TSTSHF
MOVE TT,FSFREE
TLNN F,NOSHUF
JRST .+4
MOVE T,FSMAX
HRRZ TT,-1(T)
SKIPGE -1(T)
CAIGE TT,2200
POPJ P,
TRZ TT,1777
MOVNS TT
PUSHJ P,CRUNCH
HRRO A,FSMAX
SKIPL T,-1(A)
POPJ P, ;OOPS
SUBI T,200 ;LEAVE THIS MUCH ROOM
SUBB A,T
CALLI T,11
JRST 4,.
MOVE T,JOBREL
AOS TT,T
SUB T,FSMAX
ADDM T,FSFREE
ADDB T,FSMAX
SUBI TT,-200(A)
HRROM TT,-200(A)
HRROM TT,-1(T)
POPJ P,
CRUNCH: MOVE A,FSMAX
MOVEM A,FSBIG
PUSH P,C
PUSH P,D
PUSH P,TT
PUSHJ P,FSLSCN
JFCL ;SHOULDN'T HAPPEN UNLESS CORE LOCKED
POP P,T
CAME TT,T
PUSHJ P,FSLSHF
POP P,D
POP P,C
POPJ P,
CMPACT: MOVN TT,FSFREE
JUMPE TT,CPOPJ
PUSH P,A
PUSHJ P,CRUNCH
JRST POPAJ
;ENDSET, ENDFIX
ENDSET: MOVE A,FSMAX
SKIPL TT,-1(A)
MOVEI TT,
SUB TT,FSFREE
HRREI TT,200(TT)
JUMPGE TT,.+2
PUSHJ P,CRUNCH
MOVE A,FSMAX
SKIPGE T,-1(A)
SUBI A,(T)
MOVEM A,FSEND#
MOVEM A,FSEND1#
JUMPGE T,.+3
MOVNI T,(T)
ADDM T,FSFREE
POPJ P,
ENDFIX: MOVEI TT,
EXCH TT,FSEND1
MOVE T,FSEND
SUB T,TT
ADDM T,FSUSE
ADD T,TT
MOVEM T,FSMAX
CAMLE T,JOBREL
POPJ P,
CAMN TT,FSBEG
MOVEM T,FSBEG
MOVE T,JOBREL
AOJ T,
MOVEM T,FSMAX
SUB T,FSEND
HRROM T,@FSEND
HRROM T,@JOBREL
ADDM T,FSFREE
POPJ P,
;FSCHK, FCLUP1, FCLUP2, FCFR, FCDON
IFN DEBSW{
FSCHK: MOVE A,FSMAX
SOJ A,
CAME A,JOBREL
STOPJ ;Replacing a Jrst 4,.
FSCHK1: SETZB D,E
MOVE A,FSMIN
FCLUP1: CAMN A,FSBEG
JRST FCLUP2
CAML A,FSMAX
STOPJ
SKIPGE T,(A)
STOPJ
PUSHJ P,FUCHK
AOJA B,FCLUP1
FCLUP2: CAMN A,FSMAX
JRST FCDON
CAMLE A,FSMAX
STOPJ
SKIPGE T,(A)
JRST FCFR
PUSHJ P,FUCHK
AOJA B,FCLUP2
FCFR: HLRZ TT,T
CAIE TT,-1
STOPJ
ADDI A,(T)
MOVE TT,-1(A)
CAME TT,T
STOPJ
ADDI E,(T)
JRST FCLUP2
FCDON: CAME D,FSUSE
STOPJ
CAME E,FSFREE
STOPJ
IFE PURESW,<
SKIPL PURFLG
POPJ P,
PUSH P,B
PUSHJ P,PURCHK
POP P,B
> JRST POPJ1
;FUCHK, MOVIT, MOVTX
FUCHK: XCT @-1(P)
HLRZ TT,T
CAIL TT,MXSHF
STOPJ ;MACRO for PUSHJ P,STOPJ replacing a JRST 4,.
ADDI A,(T)
HLRZ TT,-1(A)
CAMLE TT,JOBREL
STOPJ ;MACRO for PUSHJ P,STOPJ replacing a JRST 4,.
HRRZ TT,-1(A)
CAIE TT,(T)
STOPJ ;MACRO for PUSHJ P,STOPJ replacing a JRST 4,.
ADDI D,(T)
POPJ P,
MOVIT: TLNE F,NOSHUF
POPJ P,
SKIPLE SAVMOD
PUSHJ P,SAVIT
SETCMB T,MVPHAZ#
JUMPGE T,CMPACT
PUSH P,A
PUSH P,C
PUSH P,D
MOVE A,FSMIN
MOVEM A,FSBIG
MOVN TT,FSFREE
JUMPE TT,MOVTX
PUSHJ P,FSHSCN
JFCL
ADD TT,FSFREE
JUMPLE TT,MOVTX
PUSHJ P,FSHSHF
MOVTX: POP P,D
POP P,C
JRST POPAJ
;PURINI, PLCHK, PL2CHK, PLCHKL, PLSCN0, PLSCN, PLSCN1, PLSCN2, PLSCN3
IFE PURESW,{
PURINI: JSP G,PLCHK
MOVEM A,PLCHK1
MOVEM B,PLCHK2
JSP G,PLSCN0
MOVEM A,PURCK
MOVSI H,-ADRSIZ
JSP G,PLSCN
MOVEM A,PURCK+1(H)
AOBJN H,.-2
SETOM PURFLG
SKIPE A,JOBDDT
TLNN A,-40
JRST (E)
MOVE A,-6(A) ;$I
HRLI A,(<JSR>)
MOVEM A,BPTINS
JRST (E)
PLCHK: MOVEI TT,PURLST
PL2CHK: SETZB A,B
PLCHKL: XOR A,(TT)
XOR B,-1(TT)
MOVEI T,(TT)
HRRZ TT,(TT)
CAIGE TT,(T)
JUMPN TT,PLCHKL
JRST (G)
PLSCN0: TDZA H,H
PLSCN: MOVEI B,@BITTAB+44-ADRSIZ(H)
MOVEI TT,PURLST
MOVEI A,
PLSCN1: HLRZ T,(TT)
HRLI T,1(T) ;ALLOW FOR CARRY
SUBI T,1(TT)
MOVS T,T
JUMPL H,PLSCN3
XOR A,(T)
AOBJN T,.-1
PLSCN2: HRRZ TT,-1(T)
JUMPN TT,PLSCN1
JRST (G)
PLSCN3: TRNE T,(B)
XOR A,(T)
AOBJN T,PLSCN3
JRST PLSCN2
;PURCHK, PURCH1, PURCH2, PURCH3, PURC3A
PURCHK: JSP G,PLCHK
CAMN A,PLCHK1
JUMPE TT,PURCH1
MOVEI TT,PURLST-1
JSP G,PL2CHK
CAMN A,PLCHK2
JUMPE TT,PURCH4
FATAL BOTH PURE LISTS CLOBBERED
PURCH1: CAME B,PLCHK2
JRST PURCH7
PURCH2: JSP G,PLSCN0
CAMN A,PURCK
POPJ P,
MOVE C,A
XOR C,PURCK
MOVEI D,
MOVSI H,-ADRSIZ
PURCH3: JSP G,PLSCN
CAMN A,PURCK+1(H)
JRST .+4
XOR A,C
IORI D,(B)
CAMN A,PURCK+1(H)
AOBJN H,PURCH3
CAIGE D,ENDPUR
JUMPGE H,.+2
FATAL MULTIPLE LOCATIONS CLOBBERED
REPEAT 0,<
SKIPE LSTCOM
JRST PURC3A
OPEN SWP,[17↔'DSK '↔0]
JRST 4,.
MOVE T,[LOGFIL,,OBUF]
BLT T,OBUF+3
ENTER SWP,OBUF
JRST PURC3B
MOVE T,[74,,OBUF]
BLT T,OBUF+177
MOVE T,41
MOVEM T,JOBS41↑-74+OBUF
OUTPUT SWP,[-200,,OBUF-1↔0]
MOVEI T,OBUF
BLT T,OBUF+17
SETCM T,JOBREL
MOVSI T,274(T)
HRRI T,274-1
MOVEI TT,
OUTPUT SWP,T
OPEN SWP,[17↔'DSK '↔0]
JRST 4,.
MOVE T,[SAVFIL,,OBUF]
BLT T,OBUF+3
ENTER SWP,OBUF
JRST PURC3B
MOVEI A,
MTAPE DSKO,A
USETI DSKO,1
SKIPA T,[-200,,OBUF-1↔0]
OUTPUT SWP,[-200,,OBUF-1↔0]
IN DSKO,[-200,,OBUF-1↔0]
JRST .-2
HLL T,LKUP+3
TLO T,-200
TLNE T,177
OUTPUT SWP,T
USETI DSKO,(A)
PURC3B: RELEAS SWP,
PURC3A:>
XOR C,(D)
MOVE T,(D)
CAME T,BPTINS
CAMN C,BPTINS
JRST PURCLC
PUSH P,TYOPNT
SETZM TYOPNT
OUTSTR [ASCIZ /
LOC /]
TYPOCT D
OUTSTR [ASCIZ / WAS CLOBBERED FROM /]
MOVE T,C
PUSHJ P,TYPHW
OUTSTR [ASCIZ / TO /]
MOVE T,(D)
PUSHJ P,TYPHW
POP P,TYOPNT
MOVEM C,(D)
TRO F,DSPALL
OUTSTR [ASCIZ /
IT'S FIXED. GO ON?/]
PUSHJ P,YESCHK
POPJ P,
JRST 4,.-3
;PURCH4, PURCH5, PURCH6, PURCH7, PURCLC, TYPHW, PURCK, PLCHK1, PLCHK2, PURFLG
PURCH4: MOVEI TT,PURLST-1
MOVEI A,1
PURCH5: MOVSI B,TT
HRRI B,(A)
PURCH6: MOVE T,(TT)
TRNE T,-1
ADD T,A
MOVEM T,@B
HRRZ TT,(TT)
JUMPN TT,PURCH6
JRST PURCH2
PURCH7: MOVEI TT,PURLST
MOVNI A,1
JRST PURCH5
PURCLC: SKIPN PURFLG
POPJ P,
FOR X IN(A,B,E,PURFLG){PUSH P,X↔}
JSP E,PURINI
POP P,PURFLG
POP P,E
JRST POPBAJ
TYPHW: HLRZ TT,T
JUMPE TT,TYPHW2
TYPOCT TT
TYPCHR ","
TYPCHR ","
TYPHW2: MOVEI TT,(T)
TYPOCT TT
POPJ P,
IMPURE
PURCK: BLOCK ADRSIZ+1
PLCHK1: 0
PLCHK2: 0
PURFLG: 0
BPTINS: 0
LOGFIL: SIXBIT /ELOSERDMP )( S FW/
SAVFIL: SIXBIT /ELOSERFIL )( S FW/
PURE
}
;SAVIT
SAVIT: MOVEM OBUF
MOVE [1,,OBUF+1]
BLT OBUF+137
MOVE OBUF
SKIPE T,FBBAND
JRST .+3
UFBGET T,
JRST [OUTSTR [ASCIZ /NO FAST BANDS!
/]↔POPJ P,]
MOVEM T,FBBAND#
MOVE T,JOBREL
SUBI T,140-1
MOVEM T,FBCMD+1
MOVEI T,
FBWRT T,FBCMD
JRST 4,.
POPJ P,
SAVRET: MOVE T,FBCMD+1
ADDI T,140-1
CORE T,
JRST 4,.
MOVEI T,
FBREAD T,FBCMD
JRST 4,.
MOVE [OBUF+1,,1]
BLT 137
MOVE OBUF
SETZM SAVMOD
SETZM JOBOPC
PUSHJ P,@JOBDDT
PUSH P,T
TRZE F,EDITM
SETOM LEPOS
PUSHJ P,DDTRET
SKIPGE LEPOS
TRO F,EDITM
POP P,T
POPJ P,
IMPURE
FBCMD: 140↔0↔3
PURE
;CHECK, CHECK1, CHECK2
CHECK: MOVEI B,
PUSHJ P,FSCHK
JFCL
MOVEM B,FSCNT#
SKIPG CHKMOD
JRST CHECK2
PUSHJ P,CHECK2
PUSHJ P,MOVIT
PUSHJ P,CHECK1
PUSHJ P,MOVIT
CHECK1: MOVEI B,
PUSHJ P,FSCHK
JFCL
CAME B,FSCNT
JRST 4,.
CHECK2: ADD B,JOBREL
CORE B,
JRST 4,.
MOVE B,FSMAX
MOVEM B,FSPNT#
PUSHJ P,FSCHK1
HRLZM A,(B)
MOVN B,FSCNT
HRLZ B,B
HRR B,FSPNT
AOBJP B,.+3
HRRM B,-1(B)
AOBJN B,.-1
PUSHJ P,CHKDIR
PUSHJ P,CHKPAG
PUSHJ P,CHKATT
SKIPE FSPNT
JRST 4,.
MOVE B,FSMAX
SOJ B,
CORE B,
JRST 4,.
SKIPE SAVMOD
JRST SAVIT
POPJ P,
;CHKDIR, CHKDPL
CHKDIR: MOVEI A,DIR
SETZM CHKCNT#
SETZM CHKTMP#
MOVEI DSP,CDDSP
MOVSI H,NSPEC+LSPC+DSPC
MOVNI D,1
PUSHJ P,CHKDR4
MOVN D,PAGES
HRLZ D,D
PUSHJ P,CHKDR1
AOBJN D,.-1
HRRZ T,(A)
CAIE T,DIREND
JRST 4,.
MOVSI T,(A)
CAME T,DIREND
JRST 4,.
TLNE DSP,D1BIT
TLNN DSP,DPBIT
JRST 4,.
MOVE T,CHKCNT
ADD T,DIROVH
CAME T,DIRSIZ
JRST 4,.
MOVEI A,DIREND
PUSHJ P,CHKD4A
SKIPN DPLST
POPJ P,
MOVEI A,DPLST
SETZM CHKTMP
CHKDPL: PUSHJ P,CHKDR1
HRRZ T,(A)
CAIE T,DPLST
JRST CHKDPL
HLRZ T,DPLST
CAIE T,(A)
JRST 4,.
POPJ P,
CDDSP: JRST 4,.
JRST 4,.
JRST CHKDR3
JRST 4,.
JFCL
JRST 4,.
JRST 4,.
JRST 4,.
JRST 4,.
;CHKDR1, CHKD1A, CHKDR2, CDDSP, CHKDR3, CHKDR4, CHKD4A
CHKDR1: PUSHJ P,CHKLST
HLRZ T,-1(A)
CAIE T,DIRCOD
JRST 4,.
PUSHJ P,CHKDR4
CHKD1A: TLZ E,RPMASK
TDNE E,[-1000]
JRST 4,.
MOVEI T,=12(E)
ADDM T,CHKCNT
MOVSI G,440700
HRRI G,LPDESC(A)
CHKDR2: GETCH2 H,G
SOJG E,CHKDR2
JRST 4,.
CHKDR3: ILDB C,G
CAIE C,12
JRST 4,.
ILDB C,G
CAIN C,177
CAIE E,2
JRST 4,.
HRRZ T,-1(A)
ADDI T,-3(A)
CAIE T,(G)
JRST 4,.
POPJ P,
CHKDR4: PUSHJ P,CHKD4A
MOVE E,2(A)
JSP B,CHKPNT
D1BIT,,
DIRP1
FIRPAG
TLZN E,DPBIT
POPJ P,
TLNN DSP,D1BIT
JRST 4,.
JSP B,CHKPN2
DPBIT,,
DIRPT
CURPAG
POPJ P,
CHKD4A: SKIPN T,1(A)
POPJ P,
ROT T,7
TLZ T,¬177
CAMGE T,CHKTMP
JRST 4,.
MOVEM T,CHKTMP
POPJ P,
;CHKLST, CHKFS, CHKFSL, CHKFS2, CHKPNT, CHKPN2
CHKLST: MOVEI B,(A)
HRRZ A,(A)
HLRZ T,(A)
CAIE T,(B)
JRST 4,.
CHKFS: HRLOI T,-2(A)
MOVEI C,FSPNT
SKIPN B,FSPNT
JRST 4,.
CHKFSL: CAMG T,(B)
JRST CHKFS2
MOVEI C,(B)
HRRZ B,(B)
JUMPN B,CHKFSL
JRST 4,.
CHKFS2: HLRZ T,(B)
CAIE T,-1(A)
JRST 4,.
HRRZ T,(B)
HRRM T,(C)
POPJ P,
CHKPNT: TDZN E,(B)
JRST 3(B)
CHKPN2: CAMN A,@1(B)
TDOE DSP,(B)
JRST 4,.
MOVEI T,1(D)
CAME T,@2(B)
JRST 4,.
JRST 3(B)
;CHKPAG, CHKPGP
CHKPAG: MOVEI A,PAGE
SETZM CHKCNT
MOVEI DSP,CPDSP
MOVSI H,NSPEC+LSPC
MOVN D,LINES
JUMPE D,.+3
HRLZ D,D
PUSHJ P,CHKPG1
HRRZ T,(A)
CAIE T,BOTSTR
JRST 4,.
HLRZ T,BOTSTR
CAIE T,(A)
JRST 4,.
MOVEI A,BOTSTR
MOVE E,BOTSTR+1
PUSHJ P,CHKPGP
JUMPN E,[JRST 4,.]
SKIPN WINLIN
SKIPL BOTWIN
TLNE DSP,WINBIT
TLNN DSP,ARRBIT
JRST 4,.
MOVE A,CHKCNT
MOVE T,FIRPAG
SOJG T,[AOJA A,.+1]
CAME A,CHARS
JRST 4,.
POPJ P,
CHKPGP: JSP B,CHKPNT
ARRBIT,,
ARRLIN
ARRL
JSP B,CHKPNT
WINBIT,,
WINLIN
TOPWIN
POPJ P,
;CHKPG1, CHKPG2, CPDSP, CHKPGT, CHKPTL
CHKPG1: PUSHJ P,CHKLST
HLRZ T,-1(A)
CAIE T,TXTCOD
JRST 4,.
SKIPGE E,1(A)
JRST 4,.
PUSHJ P,CHKPGP
TLNE E,-1
JRST 4,.
LDB T,[111100,,E]
ADDM T,CHKCNT
MOVSI G,440700
HRRI G,LLDESC(A)
MOVEI B,
TRNE E,777
JRST CHKPG2
ILDB C,G
CAIE C,40
JRST 4,.
CHKPG2: GETCH2 H,G
SUBI E,1001
JUMPLE E,[JRST 4,.]
AOJA B,CHKPG2
CPDSP: JRST 4,.
JRST 4,.
JRST CHKPG3
JRST 4,.
JRST CHKPGT
JRST 4,.
JRST 4,.
CHKPGT: SUBI E,1000
HRL B,B
TLO B,-10
CHKPTL: ILDB C,G
CAIE C,40
JRST 4,.
SOJLE E,[JRST 4,.]
AOBJN B,CHKPTL
ILDB C,G
CAIE C,11
JRST 4,.
JRST CHKPG2
;CHKPG3, CHKPG4, CHKPG5, CHKPG6
CHKPG3: ILDB C,G
CAIE C,12
JRST 4,.
CHKPG4: TLNN A,760000
JRST CHKPG5
ILDB C,G
JUMPE C,CHKPG4
JRST 4,.
CHKPG5: CAIE E,2000
JRST 4,.
HRRZ T,-1(A)
ADDI T,-3(A)
SKIPGE 1(A)
SUBI T,2
CAIE T,(G)
JRST 4,.
SUBM A,G
MOVSI G,LLDESC-1(G)
HRRI G,LLDESC(A)
MOVEI T,1
CHKPG6: TDNN T,(G)
JRST 4,.
AOBJN G,CHKPG6
AOBJN D,CHKPG1
POPJ P,
;CHKATT, CHKNAT
CHKATT: TRNN F,ATTMOD
JRST CHKNAT
SETZM CHKCNT
MOVEI A,ATTBUF
MOVE DSP,[ARRBIT!WINBIT,,CPDSP]
MOVSI H,NSPEC+LSPC
MOVN D,ATTNUM
JUMPE D,[JRST 4,.]
HRLZ D,D
PUSHJ P,CHKPG1
HRRZ T,(A)
CAIE T,ATTBUF
JRST 4,.
HLRZ T,ATTBUF
CAIE T,(A)
JRST 4,.
MOVE T,CHKCNT
CAME T,ATTSIZ
JRST 4,.
POPJ P,
CHKNAT: SKIPE ATTNUM
JRST 4,.
POPJ P,
IMPURE
SHFMOD: 0
CHKMOD: 0
SAVMOD: 0
PURE
}
;CTAB 0-37
ED←←EDOK*5 EDCMD←←EDOK*7
COMMENT ⊗ CTAB is Fred's clever way of keeping track of the character
flags associated with each character (in the left half-word) and of
providing the relative address of the proper location in the CMDSP
(command dispatch) table, which is accessed by loading the DSP register
with the location of the first entry. CMDSP, in turn, contains, 1)
additional flags in the left half-word (in some cases) that further
delimit the use of the command and 2) addresses in the right half to
the appropiate code. In the case of <cr> the reference is doubly
indirect and CMDSP contains the location of yet another table CRDSP,
which is indexed on B to find still other flags and code locations
for the 4 cases depending on the CONTROL and META bits associated
with the <cr> when used.
Symbols beginning with % (thus %A) are numerically defined in terms
of the location in the CMDSP table of the associated command for the
rest of the symbol (in this case A) so as to identify the command and
its flags. Fred does this with the CC macro in CMDSP on page 16.
Clever!, but confusing until one knows what is happening. ⊗
CTAB: NSPEC,,(DSP) ;NUL
ED,,%DA(DSP) ;↓
ED,,7(DSP) ;α
ED,,7(DSP) ;β
SSP2!ED,,12(DSP) ;∧
SSP1!ED,,13(DSP) ;¬
; ED,,7(DSP) ;ε
ED,,%EPSIL(DSP) ;ε
ED,,%PI(DSP) ;π
; ED,,7(DSP) ;λ
ED,,%LAMBDA(DSP) ;λ
LSPC!EDCMD,,4(DSP) ;TAB
LSPC,,3(DSP) ;LF
%U(DSP) ;VT (INTEGRAL)
SSP1!LSPC,,5(DSP) ;FF
SSP1!FSPC!LSPC,,2(DSP) ;CR
SSP1!ED,,21(DSP) ;∞
ED,,7(DSP) ;∂
SSP1!ED,,14(DSP) ;⊂
SSP2!ED,,15(DSP) ;⊃
ED,,7(DSP) ;∩
ED,,7(DSP) ;∪
NOESS,< SSP1!ED,,16(DSP) ;∀>
ESSAY,< SSP1!ED,,%FRALL(DSP) ;∀>
; ED,,7(DSP) ;∃
ED,,%EXIST(DSP) ;∃
DSPC!ED,,10(DSP) ;⊗
ED,,7(DSP) ;↔
LT2F!ED,,7(DSP) ;_
; FSPC!ED,,7(DSP) ;→
FSPC!ED,,%RA(DSP) ;→
ED,,7(DSP) ;~
ED,,7(DSP) ;≠
ED,,%LE(DSP) ;≤
ED,,%GE(DSP) ;≥
SSP1!ED,,17(DSP) ;≡
SSP2!ED,,20(DSP) ;∨
;CTAB 40-77
EDCMD,,7(DSP) ;SP
ED,,7(DSP) ;!
ED,,7(DSP) ;"
ED,,7(DSP) ;#
LT2F!ED,,7(DSP) ;$
LT2F!ED,,7(DSP) ;%
ED,,7(DSP) ;&
ED,,7(DSP) ;'
FSPC!ED,,7(DSP) ;(
ED,,7(DSP) ;)
ED,,7(DSP) ;*
ED,,%PLS(DSP) ;+
FSPC!ED,,7(DSP) ;,
ED,,%MIN(DSP) ;-
FSPC!ED,,%.(DSP) ;.
FSPC!ED,,7(DSP) ;/
NUMF!ED,,11(DSP) ;0
NUMF!ED,,11(DSP) ;1
NUMF!ED,,11(DSP) ;2
NUMF!ED,,11(DSP) ;3
NUMF!ED,,11(DSP) ;4
NUMF!ED,,11(DSP) ;5
NUMF!ED,,11(DSP) ;6
NUMF!ED,,11(DSP) ;7
NUMF!ED,,11(DSP) ;8
NUMF!ED,,11(DSP) ;9
FSPC!ED,,7(DSP) ;:
FSPC!DSPC!ED,,10(DSP) ;;
ED,,%LT(DSP) ;<
ED,,7(DSP) ;=
ED,,%GT(DSP) ;>
; ED,,7(DSP) ;?
ED,,%QUERY(DSP) ;?
;CTAB 100-137
ED,,7(DSP) ;@
LETF!ED,,%A(DSP) ;A
LETF!ED,,%B(DSP) ;B
LETF!ED,,%C(DSP) ;C
LETF!EDCMD,,%D(DSP) ;D
LETF!ED,,%E(DSP) ;E
LETF!ED,,%F(DSP) ;F
LETF!ED,,%G(DSP) ;G
; LETF!ED,,7(DSP) ;H
LETF!ED,,%H(DSP) ;H
LETF!EDCMD,,%I(DSP) ;I
LETF!ED,,%J(DSP) ;J
LETF!EDCMD,,%K(DSP) ;K
LETF!ED,,%L(DSP) ;L
LETF!ED,,%M(DSP) ;M
LETF!ED,,7(DSP) ;N
LETF!ED,,7(DSP) ;O
; LETF!ED,,%O(DSP) ;O
LETF!ED,,%P(DSP) ;P
LETF!ED,,%Q(DSP) ;Q
LETF!ED,,%R(DSP) ;R
LETF!EDCMD,,7(DSP) ;S
LETF!ED,,%T(DSP) ;T
LETF!ED,,%U(DSP) ;U
LETF!ED,,%V(DSP) ;V
LETF!ED,,%W(DSP) ;W
LETF!ED,,%X(DSP) ;X
LETF!ED,,7(DSP) ;Y
LETF!ED,,7(DSP) ;Z
FSPC!ED,,7(DSP) ;[
; ED,,7(DSP) ;\
ED,,%BSLAS(DSP) ;\
FSPC!ED,,7(DSP) ;]
ED,,%UA(DSP) ;↑
; FSPC!ED,,7(DSP) ;←
FSPC!ED,,%LA(DSP) ;←
;CTAB 140-177
ED,,7(DSP) ;`
LETF!LT2F!ED,,%A(DSP) ;a
LETF!LT2F!ED,,%B(DSP) ;b
LETF!LT2F!ED,,%C(DSP) ;c
LETF!LT2F!EDCMD,,%D(DSP) ;d
LETF!LT2F!ED,,%E(DSP) ;e
LETF!LT2F!ED,,%F(DSP) ;f
LETF!LT2F!ED,,%G(DSP) ;g
; LETF!LT2F!ED,,%G(DSP) ;g
; LETF!LT2F!ED,,7(DSP) ;h
LETF!LT2F!ED,,%H(DSP) ;h
LETF!LT2F!EDCMD,,%I(DSP) ;i
LETF!LT2F!ED,,%J(DSP) ;j
LETF!LT2F!EDCMD,,%K(DSP) ;k
LETF!LT2F!ED,,%L(DSP) ;l
LETF!LT2F!ED,,%M(DSP) ;m
LETF!LT2F!ED,,7(DSP) ;n
LETF!LT2F!ED,,7(DSP) ;o
; LETF!LT2F!ED,,%O(DSP) ;o
LETF!LT2F!ED,,%P(DSP) ;p
LETF!LT2F!ED,,%Q(DSP) ;q
LETF!LT2F!ED,,%R(DSP) ;r
LETF!LT2F!EDCMD,,7(DSP) ;s
LETF!LT2F!ED,,%T(DSP) ;t
LETF!LT2F!ED,,%U(DSP) ;u
LETF!LT2F!ED,,%V(DSP) ;v
LETF!LT2F!ED,,%W(DSP) ;w
LETF!LT2F!ED,,%X(DSP) ;x
LETF!LT2F!ED,,7(DSP) ;y
LETF!LT2F!ED,,7(DSP) ;z
ED,,7(DSP) ;{
SSP1!ED,,22(DSP) ;|
LSPC,,6(DSP) ;ALT-MODE
ED,,7(DSP) ;}
NSPEC,,1(DSP) ;RUBOUT
NSPEC,,-1(DSP) ;SEE RDPAG1
;GETDIR
GETDIR: MOVEI DSP,GDDSP ;Initial dispatch table on page 113
FOR X IN (DIR,PAGES,FIRPAG,CURPAG,RLDRUB,SOSBIN#,SOSLIN#,SOSLI2#,SOSPAG#){SETZM X↔}
MOVEI T,XDIRCH
MOVEM T,DIROVH#
MOVEM T,DIRSIZ#
PUSHJ P,ENDSET
MOVSI G,NSPEC+LSPC+NUMF ;For XCT @CTAB(C) on NUL,RUB,CR,LF,TAB,FF,ALT and digits
MOVE H,INPNT
SETZB A,Q
MOVE B,[440700,,[ASCIZ /COMMENT ⊗ xxVALID PAGES/]]
MOVE D,[160700,,Q]
ILDB C,H ;First character
SKIPGE CTAB(C)
XCT @CTAB(C) ;Special LINE-EDIT case
MOVE T,(H)
AND T,[BYTE (7)160,160,160,160,160(1)1]
CAMN T,[ASCID /00000/]
JRST .+3
CAME T,[ASCID / /]
JRST DIRCL1
HLLOS @SRCFIL+4 ;Signal non-normal directory case
AOJA H,DIRCL
;Test file to see if it is a reasonable source file
NODIRT: MOVEI T,0 ;Counter
MOVEI TT,200*5-1 ;To index through IBUF
NODIR1: ILDB C,H ;Read a character
NODIR2: TLNE G,CTAB(C) ;Is it a special one
JRST NODIR4 ;Yes
NODIR3: SOJG TT,NODIR1 ;Try again
JRST NODIR5 ;Something is wrong
NODIR4: CAIN C,11 ;A TAB here is OK
JRST NODIR3
CAIE C,15 ;Then it must be a CR
JRST NODIR5 ;But it is not
SOJLE TT,NODIR5 ;Have we come to the end?
ILDB C,H ;Get next character after a CR
;MUST FIX TO HANDLE SOS FILES
CAIN C,12 ;It must be a LF
JRST NODIR7 ;It is
ILDB C,H ;Now what
CAIE C,15 ;Could be an SOS file
JRST NODIR5 ;I guess not
SOJLE TT,NODIR5
ILDB C,H
CAIE C,14 ;Might be CR CR FF combination
JRST NODIR5 ;But it is not
SOJG TT,NODIR1 ;Give it the benefit of doubt
JRST NODIR5
NODIR7: AOS T ;add 1 to count of CRLF's
CAIL T,4 ;Have we found 4 of them?
JRST NODIR ;Yes so safe to assume text is in ASCII
SOJLE TT,NODIR5 ;At the end yet?
ILDB C,H ;But now what follows?
JUMPN C,NODIR2 ;Not a NULL
CAIL T,3 ;Have we counted 3 CRLF's?
JRST NODIR ;Yes so looks OK
MOVE C,1(H) ;Look for more NULLs,could be a short file
JUMPE C,NODIR ;Will assume that it is
NODIR5: OUTSTR [ASCIZ /
Not a normal source file!! /]
MOVE T,EDFIL+3 ;Get file PPN
JUMPN T,.+2
MOVE T,PPN ;If no file PPN check alias
CAME T,RPPN ;Compare with users name
JRST NODIR6
OUTSTR [ASCIZ /
Do you really want to edit /]
MOVEI D,@DSTFIL
PUSHJ P,FILTYP
OUTSTR [ASCIZ / ? (Y OR N) /]
PUSHJ P,YESCHK
JRST NODIR
TLNE F,ZATT
PUSHJ P,EPSIL4
SUB P,[1,,1]
JRST FNF2
NODIR6: OUTSTR [ASCIZ /To edit it, you must be logged in with file PPN./]
TLNE F,ZATT
PUSHJ P,EPSIL4
SUB P,[1,,1]
JRST FNF2
;DIRCL2, DIRCL, DIRCL1, GETDR1
DIRCL2: IDPB C,D
DIRCL: GETCH2 G,H ;Read character (checked for specials and digits)
DIRCL1: ILDB E,B ;Get expected character into E
CAIN C,(E)
JRST DIRCL ;It checks so try next
CAIN E,"x"
JRST DIRCL2
JUMPN E,NODIR
; JUMPN E,NODIRT ;Is it a binary file?
MOVEI D,DIR
CAIN Q," "
JRST .+3
CAIE Q,"IN"
; JRST NODIRT ;Is it a binary file?
JRST NODIR
JUMPE A,NODIR
; JUMPE A,NODIRT ;Still check if binary
SKIPN @SRCFIL+4
CAIE Q," "
JRST BADDIR
MOVEM A,PAGES
MOVNI B,(A)
CAIE C," "
TDZA E,E
MOVE E,[440700,,VBUF]
MOVSI G,LSPC!NSPEC ;For XCT @CTAB(C) ON NULL,RUBOUT,CR,LF,TAB,FF,ALT
MOVNI T,1
JSP TT,LSKP2 ;Eats characters looking for one defined by G
JUMPE E,GETD1A
IDPB C,E
MOVEI C,177
IDPB C,E
CAMN E,[100700,,VBUF]
GETD1A: SETZB T,VBUF
ADDB T,DIROVH
MOVEM T,DIRSIZ
HLRZ T,@SRCFIL+1
CAIN T,'F4 '
SKIPE RDONLY
JRST GETDR1
GETCH2 G,H
CAIN C,"C"
JRST GETDR1
OUTSTR [ASCIZ /OLD FORMAT DIRECTORY.
REWRITE?/]
PUSHJ P,YESCHK
TRO F,UPDTXT
GETDR1: JSP TT,LSKP1
MOVE E,FSEND
MOVEI TT,DIRLF
;DIRLIN, DIRLUP, DIRDON
;The code that actually checks up on the directory page
DIRLIN: GETCH2 G,H ;SKIP C (OR SPACE)
MOVEI A,
MOVSI G,NSPEC+LSPC+NUMF
GETCH2 G,H ;READ REC
DIRLN2: MOVEI E,1(E)
HRRM E,(D)
LEG HRLZM D,(E)
MOVEI D,(E)
LEG MOVEM A,1(D)
ADD E,[440700,,LPDESC]
MOVSI G,NSPEC+LSPC
REPEAT 5,{GETCH2 G,H} ;SKIP PAGE #
MOVEI Q,1
DIRLUP: GETCH2 G,H
LEG IDPB C,E
AOJA Q,DIRLUP
DIRLF:
LEG IDPB C,E
MOVEI C,177
LEG IDPB C,E
ADDI E,2
MOVSI T,DIRCOD
FSFIX E,T
HRRZM Q,2(D)
ADDM Q,DIRSIZ
AOJL B,DIRLIN
TRNE F,FILLUZ
JRST GDIRX
GETCH2 G,H
MOVEI A,
MOVSI G,NSPEC+LSPC+NUMF
GETCH2 G,H
SOJ A,
; CAMGE A,FILLEN
; OUTSTR [ASCIZ /WARNING -- FILE LONGER THAN DIRECTORY INDICATES.
;]
CAML A,FILLEN
JRST DIRLF1
OUTSTR [ASCIZ/
File is /]
SUB A,FILLEN
MOVNS A
SETZM TYOPNT
TYPDEC A
OUTSTR [ASCIZ / records longer than directory indicates.
Is it safe to assume that additions were to the last page only? (Y or N) /]
PUSHJ P,YESCHK
JRST .+2
JRST DELDIR
MOVE A,FILLEN
TRO F,UPDTXT
; CAMLE A,FILLEN
; FATAL FILE SHORTER THAN DIRECTORY INDICATES
DIRLF1: CAMG A,FILLEN
JRST DIRLF2
OUTSTR [ASCIZ /
File is /]
SUB A,FILLEN
SETZM TYOPNT
TYPDEC A
MOVE A,FILLEN
AOJ A
MOVEM A,DIREND+1
; PUSHJ P,ENDFIX
; PUSHJ P,FLSDIR
; HRLOM H,@SRCFIL+4
OUTSTR [ASCIZ / records shorter than directory indicates.
Do you want old directory saved as a part of the text? (Y or N) /]
PUSHJ P,YESCHK
JRST NODIR
JRST DELDIR
DIRLF2: AOJ A,
MOVEM A,DIREND+1
GETCH2 G,H
CAIE C,"E"
JRST LOSDIR
SOS SPAGE ;I DON'T KNOW WHY
TRO F,DIROK
SKIPE @DSTFIL+4
TRO F,COPY
GDIRX: MOVEI E,DIREND
HRRM E,(D)
HRLZM D,DIREND
PUSHJ P,ENDFIX
MOVE T,PAGES
IMULI T,=12 ;CHARS/LINE FOR NUMS
ADDB T,DIRSIZ
MOVEM T,ODSIZ#
SETZM DIREND+2
POPJ P,
;LOSDIR, BADDIR, NODIR, DIRNUM, GDDSP, LSKP1, DIRSHF, DIREND
LOSDIR: SKIPN PAGES
JRST NODIR
PUSHJ P,ENDFIX
PUSHJ P,FLSDIR
SKIPA T,[[ASCIZ /DIRECTORY IS GARBLED - WILL RECREATE/]]
BADDIR: MOVEI T,[ASCIZ /DIRECTORY INVALID OR UNDESIRED/]
SKIPE QUIETF
JRST DELDIR
OUTSTR (T)
OUTSTR [ASCIZ /. KEEP OLD ONE AS PART OF TEXT?/]
HRLOM H,@SRCFIL+4
PUSHJ P,YESCHK
JRST NODIR
DELDIR: SETOM @SRCFIL+4
SOS SPAGE
TROA F,COPY
NODIR: HLLOS @SRCFIL+4
MOVEI D,DIR
SETZM DIREND+1
TRO F,FILLUZ
TRZ F,UPDTXT
SKIPN RDONLY
TROA F,COPY
SKIPE DIR
JRST GDIRX
AOS PAGES
MOVE E,FSEND
MOVEI A,1
MOVEI B,
MOVEI TT,DIRLF
MOVE H,[440700,,[ASCII /XXXXX
/]]
JRST DIRLN2
FLSDIR: SETZM PAGES
SKIPN A,DIR
POPJ P,
TLO F,NOCHK ;Added by ALS
HRRZ B,(A)
CAIE A,DIREND
PUSHJ P,FSGIVE
SKIPE A,B
JRST .-4 ;Was .-3 . Changed 12/3/74
TLZ F,NOCHK ;Added by ALS
MOVEI T,XDIRCH
MOVEM T,DIRSIZ
SETZM DIR
POPJ P,
DIRNUM: IMULI A,12
ADDI A,-"0"(C)
JRST -3(T)
;THIS IS THE DISPATCH TABLE (DSP) USED BY GETDIR. REFERENCED BY XCT @CTAB(C)
GDDSP: JSP C,[JRST -3(C)]
PUSHJ P,RLD
JFCL
JRST (TT)
JFCL
JRST LOSDIR ;FF IN MID-DIR EATS IT
MOVEI C,"}"
JRST 4,.
JRST 4,.
JSP T,DIRNUM
LSKP1: GETCH2 G,H
GETCH2 G,H
JRST LSKP1
LSKP2A: GETCH2 G,H
LSKP2: IDPB C,E
AOJA T,LSKP2A
DIRSHF: PUSHJ P,LSTSHF
SKIPGE T,3(A)
ADDM C,DIRPT
TLNE T,D1BIT
ADDM C,DIRP1
POPJ P,
IMPURE
DIREND: BLOCK LPDESC
PURE
;COPFIL, COPFL1, COPDO, COPYX, COPDAT, COPLUP
COPFIL: TRZN F,COPY
POPJ P,
TLZ F,TF1
MOVE A,@DSTFIL
MOVE B,@DSTFIL-1
CAMN B,@SRCFIL-1
CAME A,@SRCFIL
JRST COPFL0
HLRZ B,@SRCFIL+1
HLRZ C,@DSTFIL+1
MOVE A,@DSTFIL+3
CAIN B,(C)
CAME A,@SRCFIL+3
COPFL0: PUSHJ P,COPCHK
MOVE T,@SRCFIL+2
MOVEM T,@DSTFIL+2
HRRZ T,@SRCFIL+1
HRRM T,@DSTFIL+1
MOVEI E,@DSTFIL
PUSHJ P,OPENO
SKIPN @SRCFIL+4
SKIPE @DSTFIL+4
JRST FORMAT
MOVEI A,1
COPFL1: PUSHJ P,SETI
PUSHJ P,COPCOR
MOVS A,LKUP+3
COPDO: PUSHJ P,COPDAT
COPYX: CLOSE DSKO,
RELEAS DSKO, ;SHIT-EATING SYSTEM!
SETZM JOBJDA+DSKO
MOVE A,FSMAX
SUBI A,1
CORE A,
JRST 4,.
POPJ P,
COPDAT: JUMPGE A,CPOPJ
DPB A,[221200+COPNUM*100,,COPCMD]
INPUT DSKI,COPCMD
OUTPUT DSKO,COPCMD
ASH A,-12-COPNUM
AOJGE A,CPOPJ
MOVEI B,
DPB B,[310300+COPNUM*100,,COPCMD]
COPLUP: INPUT DSKI,COPCMD
OUTPUT DSKO,COPCMD
AOJL A,COPLUP
POPJ P,
;COPCOR, COPCHK, YESCHK, COPCMD
COPCOR: MOVE T,JOBREL
HRRM T,COPCMD
ADDI T,2000⊗COPNUM
CORE T,
JRST 4,.
POPJ P,
COPCHK: TLO F,TF1
SKIPE QUIETF
POPJ P,
MOVSI T,@DSTFIL
ADD T,[-1,,ENTR-1]
MOVEI C,DSKO
PUSHJ P,OPNDEV
LOOKUP DSKO,ENTR
POPJ P,
CLOSE DSKO,
OUTSTR [ASCIZ/FILE ALREADY EXISTS: /]
MOVEI D,@DSTFIL
PUSHJ P,FILTYP
OUTSTR [ASCIZ/
REPLACE?/]
PUSHJ P,YESCHK
POPJ P,
SUB P,[2,,2]
JRST FNF2
YESCHK: CLRBFI
INCHRW C
CAIN C,15
INCHRW C
CAIE C,12
OUTSTR [ASCIZ/
/]
CAIE C,"Y"
CAIN C,"y"
POPJ P,
JRST POPJ1
IMPURE
COPCMD: -2000,,
0
PURE
;FORMAT, FMTOK, FMTDSP
FORMAT: TLNN F,TF1
SKIPE QUIETF
JRST FMTOK
HLLZ T,@SRCFIL+4
XOR A,RPPN
TRNN A,-1
JUMPN T,FMTOK
SKIPE CREASW
JRST FMTOK
OUTSTR [ASCIZ /NEED TO REFORMAT /]
MOVEI D,@DSTFIL
PUSHJ P,FILTYP
OUTSTR [ASCIZ /. OK?/]
PUSHJ P,YESCHK
JRST FMTOK
SUB P,[1,,1]
JRST FNF2
FMTOK: MOVEI A,1
PUSHJ P,SETI
MOVE A,@SRCFIL+4
ROT A,1
ANDI A,3
MOVE T,TRMCHR
CAIE T,"→"
XCT FMTDSP(A)
OUTSTR [ASCIZ /REQUESTED FORMAT CHANGE MODE NOT IMPLEMENTED.
/]
JRST GETOU1
FMTDSP: JFCL
JRST 4,.
JRST MAKDIR
JRST NEWDIR
;This code is to check a new file that is being read is when a new directory
;is called for and there is some question as to whether the file is a proper
;one. Tests are made for SOS type files and for XGP files specifically and a
;warning is to be given for binary looking files.
;It will be called after each input buffer load has been read in.
FMTOK2: MOVEI T,200*5-1
FMTOK3: MOVE C,1(G) ;Get next word
TRNE C,1 ;Is unit bit on?
JRST FMTOK5 ;Yes
FMTOK4: ILDB C,G ;Now look at it character by character
TLNE G,CTAB(C) ;Is it a special character?
JRST FMTOK6 ;Yes
TLNE H,760000 ;Is this the last character from this word
SOJG T,FMTOK4 ;Get next character
SOJG T,FMTOK3 ;It is, so see if next word is an SOS line nummber
JRST FMTOK ;Nothing seems to be wrong in first record
;Bit 35 is on so not normal text
FMTOK5: ILDB C,G ;May be SOS line number
CAIL C,60
CAILE C,71
JRST FMTOKX ;Not a digit
TLNE H,760000 ;Is this the last character from this word
SOJG T,FMTOK5 ;It is not
SOJLE T,FMTOK ;It was and first record seems OK
MOVE C,1(G) ;Is next word normal?
TRNE C,1
JRST FMTOKX ;Not allowed
ILDB C,G
CAIN C,11 ;Next caracter must be a TAB
SOJG T,FMTOK4 ;It is
JRST FMTOKX ;Not a TAB
;A special character NUL,TAB,LF,VT,FF,CR,ALT,BS following normal text
FMTOK6: CAIN C,11 ;Is it a TAB
SOJG T,FMTOK4 ;This is OK
JUMPE T,FMTOK ;At end of first record and all is well
CAIN C,14 ;It coulf be a FF in an unformatted file
FMTOK7: CAIE C,15 ;CR must come first
JRST FMTOKX ;Too bad
SOJLE T,FMTOK ;Nothing wrong in first record
ILDB C,G ;This one is more critical
CAIE C,12 ;It should be a LF
JRST FMTOKX ;It failed the test
SOJLE T,FMTOK ;OK
TLNN H,760000 ;Are we at the last character in the word?
JRST FMTOK8 ;yes
ILDB C,G
CAIN C,0 ;Any number of NULLs are OK
SOJG T,.-2
JUMPE T,FMTOK ;First record seems OK
TLNE G,CTAB(C) ;Is it a special character?
JRST FMTOK6 ;It is, could be a TAB or another CR
SOJG T,FMTOK4 ;Back to normal text
JRST FMTOK ;First record seems OK
FMTOK8: MOVE C,1(G) ;Look at the next word
JUMPN C,FMTOK9 ;Not all nulls
AOS G
SUBI T,5
JUMPG T,FMTOK8 ;Well then the next word
JRST FMTOK ;First record seems OK
FMTOK9: TRNN C,1 ;Could it be an SOS line number or page mark?
JRST FMTOK4 ;It seems to be normal text
CAME C,[ASCID / /] ;Is it an SOS page mark?
JRST FMTOK5 ;No, test it for a line number
AOS G ;It may be so look at the next word
SUBI T,5
JUMPLE T,FMTOK ;At end of the record
CAME C,[064521420101] ;CR CR FF SP SP with unit bit
JRST FMTOKX ;Something is wrong
AOS G
SUBI T,5
JUMPG T,FMTOK5 ;The next word must be aa line number
FMTOKX:
;NEWDIR, NEWDLP, SKPDSP, NEWDFF, OPUT, OSET, TMPDIR
NEWDIR: MOVEI DSP,SKPDSP
MOVSI H,LSPC+NSPEC
MOVE G,INPNT
NEWDLP: GETCH2 H,G
GETCH2 H,G
JRST NEWDLP
SKPDSP: JSP C,RDLNUL
PUSHJ P,RLD
JRST NEWDLP
JRST NEWDLP
JRST NEWDLP
JRST NEWDFF
JRST NEWDLP
NEWDFF: SKIPE @DSTFIL+4
JRST MAKDR0
SKIPA T,IBLK
PUSHJ P,WRBUF
SOJG T,.-1
JRST MAKDR0
OPUT: PUSHJ P,WRBUF
OSET: MOVN A,OCNT
HRLI B,(A)
MOVE A,OPNT
POPJ P,
;MAKDIR, MAKDR0, MAKDR1, MAKDOL, MDOL1
MAKDIR: MOVE G,INPNT
MOVEI C,14
MAKDR0: PUSHJ P,FLSDIR
SKIPE @DSTFIL+4
JRST MAKDR1
MOVE T,[DIR,,DIREND]
PUSHJ P,DIRAD1
MOVNI T,=12
ADDM T,DIRSIZ ;DON'T COUNT THIS TWICE
MOVEI T,1
MOVEM T,1(A)
SKIPA D,A
MAKDR1: MOVEI D,DIR
PUSHJ P,ENDSET
MOVE E,FSEND
MAKDOL: PUSHJ P,OSET
HRRI B,
SKIPN PAGES
JRST MDOL1
IDPB C,A
AOBJN B,.+2
PUSHJ P,OPUT
MDOL1: MOVEI E,1(E)
HRRM E,(D)
LEG HRLZM D,(E)
MOVEI D,(E)
MOVE T,OBLK
LEG MOVEM T,1(D)
ADD E,[350700,,LPDESC]
MOVSI T,(<BYTE (7)11>)
LEG MOVEM T,(E)
HRRI B,1
MOVSI H,LSPC+DSPC+NSPEC
MOVEI DSP,MD1DSP ;Dispatch table on page 119
MOVE T,[440700,,T]
MOVEM T,INPNT
SETZB T,TT
JSP Q,SOSCHK
;MDIL1, MDIL1A, MDIL2, MDIL2A, MDCSRC, MDCSR1, MD1DSP
MDIL1: GETCH2 H,G
IDPB C,A
AOBJN B,.+2
PUSHJ P,OPUT
LEG IDPB C,E
CAIL C,140
SUBI C,40
IDPB C,INPNT
CAIG C,40
JRST MDCSRC
TRNN B,-10
JRST MDIL1
MDIL1A: MOVEI DSP,MD2DSP ;Also set to this table on page 118
MOVEI T,MD2CR
MOVEM T,INPNT
MDIL2: GETCH2 H,G
LEG IDPB C,E
MDIL2A: IDPB C,A
AOBJN B,MDIL2
PUSHJ P,OPUT
JRST MDIL2
MDCSRC: PUSHJ P,MDCSR1
JUMPGE DSP,MDIL1A
MOVSI G,350700
HRRI E,LPDESC(D)
HRRI B,400001
JRST MDIL1A
MDCSR1: MOVSI DSP,-NSCOMS
DPB DSP,INPNT
CAMN T,SCOMS(DSP)
CAME TT,SCOMS2(DSP)
AOBJN DSP,.-2
POPJ P,
MD1DSP: JSP C,RDLNUL
PUSHJ P,RLD
JRST MD1CR
JRST MAKDLF
JFCL
JRST MDFF1
MOVEI C,"}"
JRST 4,.
JRST MDIL1B
;MDIL1B, MAKDLF, MAKDFF, MDFF2, MDFF3, MDCEOL, MD2DSP
MDIL1B: IDPB C,A
AOBJN B,.+2
PUSHJ P,OPUT
SOJA B,MDIL1
MAKDFF: TRNN B,-2
JRST MDFF2
MAKDLF: ADD G,[70000,,]
MOVEI C,15
JRST @2(DSP)
MDFF1: TRNE B,-2
JRST MAKDLF
MOVEI C,15
PUSHJ P,MDFIX
MOVEI C,14
MDFF2: JUMPE A,MDFF3
MOVEM A,OPNT
MOVE A,D
PUSHJ P,CLOSO
MOVE D,A
MDFF3: TRNN F,EOF
JRST MAKDOL
MOVE T,OBLK
MOVEM T,DIREND+1
PUSHJ P,GDIRX
TRO F,DIROK
TRZ F,FILLUZ
SKIPN @DSTFIL+4
TRO F,UPDTXT
JRST COPYX
MDCEOL: PUSHJ P,MDCSR1
TRNE B,-2
JUMPGE DSP,CPOPJ
MOVSI E,440700
HRRI E,LPDESC(D)
HRRI B,
POPJ P,
MD2DSP: JSP C,RDLNUL ;DSP set for this dispatch table on page 121
PUSHJ P,RLD
JRST @INPNT
JRST MAKDLF
JFCL
JRST MAKDFF
MOVEI C,"}"
JRST 4,.
SOJA B,MDIL2A
;MD1CR, MD2CR, MD3CR, MD3CR1, MDIL3, MDCRCK, MDFIX
MD1CR: IBP INPNT
PUSHJ P,MDCEOL
MD2CR: PUSHJ P,MDFIX
MOVSI H,LSPC+NSPEC
MOVEI T,MD3CR
MOVEM T,INPNT
MD3CR: IDPB C,A
AOBJN B,.+2
PUSHJ P,OPUT
MOVEI C,12
IDPB C,A
AOBJN B,.+2
PUSHJ P,OPUT
HRRI B,1
SKIPA DSP,[MDCRCK] ;Table below
MD3CR0: MOVEI DSP,MD2DSP ;Table on page 120
MD3CR1: GETCH2 H,G
MOVEI DSP,MD2DSP
JSP Q,SOSCK2
MDIL3: GETCH2 H,G
IDPB C,A
AOBJN B,MDIL3
PUSHJ P,OPUT
JRST MDIL3
MDCRCK: JSP C,RDLNUL
PUSHJ P,RLD
JRST MD3CR1
JRST MD3CR0
JFCL
JRST MDFF2
MOVEI C,"}"
MDFIX: MOVEI T,12
LEG IDPB C,E
LEG IDPB T,E
MOVEI T,177
LEG IDPB T,E
ADDI E,2
MOVSI T,DIRCOD
FSFIX E,T
LDB T,[2100,,B]
ADDI T,2
MOVEM T,2(D)
ADDM T,DIRSIZ
AOS PAGES
POPJ P,
;CREATE, CREAT2, CTEXT
CREATE: TRZ F,COPY
SKIPN @DSTFIL
JRST FLOSE
PUSHJ P,COPCHK
; LDB T,[1400,,DATBLK] ;MUST FIX ******
; HRRM T,@DSTFIL+1
; LDB T,[POINT 12,DATBLK,17]
; DPB T,[POINT 12,@DSTFIL+2,35]
; LDB T,[POINT 3,DATBLK,5]
; DPB T,[POINT 3,@DSTFIL+1,20]
HLLZS @DSTFIL+1 ;Zero entire right half first
LDB T,[POINT 12,DATBLK,17] ;Now get date
DPB T,[POINT 12,@DSTFIL+1,35] ;and put it in right half
LDB T,[POINT 15,DATBLK,17] ;Now get date
DPB T,[POINT 15,@DSTFIL+1,35] ;and put it in right half
MOVEI E,@DSTFIL
PUSHJ P,OPENO
SKIPE @DSTFIL+4
JRST CREAT2
MOVE A,[CTEXT,,OBUF]
BLT A,OBUF+LCTEXT-1
SETZM OBUF+LCTEXT
MOVE A,[OBUF+LCTEXT,,OBUF+LCTEXT+1]
BLT A,OBUF+377
MOVSI A,(<BYTE(7)14>)
MOVEM A,OBUF+200
OUTPUT DSKO,[-400,,OBUF-1↔0]
CREAT2: CLOSE DSKO,
MOVE A,[DSTFIL,,SRCFIL]
BLT A,SRCFIL+4
POPJ P,
CTEXT: ASCII/COMMENT ⊗ VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002
C00003 ENDMK
C⊗;
/
LCTEXT←←.-CTEXT
;RDPAGE, RDPGOK, RDSPAG, RDPAG0
;Note skip return
RDPAGE: TRZ F,UPDIR+WRITE+XPAGE+EDDIR
MOVE B,A
CAMGE A,DIRPAG
HRRO A,DIRPAG
CAMLE A,PAGES
HRRO A,PAGES
JUMPL A,RDPGLZ
AOS (P)
RDPGOK: CAMN A,FIRPAG
JRST RDSPAG
PUSHJ P,FNDPAG
JUMPN T,.+2
MOVEI T,DIR
MOVSI TT,D1BIT
IORM TT,2(T)
EXCH T,DIRP1#
JUMPE T,.+2
ANDCAM TT,2(T)
HRRZM A,FIRPAG
RDSPAG: MOVEI T,(A)
MOVE A,[440700,,C]
MOVEI C,1
PUSHJ P,NUMSTR
MOVEM C,HEDPAG
MOVEM C,HED2PG
PUSHJ P,CLRWR2
SETZM CHARS#
SETZM ROOM
SETZM RELPGN
MOVE A,FIRPAG
RDPAG0: SETZM LINES
TRNE A,-2
AOS CHARS ;FF ON MOST PAGES
MOVE B,A
PUSHJ P,FNDPAG
MOVEM A,CURPAG
MOVE D,T
EXCH T,DIRPT#
MOVSI TT,DPBIT
JUMPE T,.+2
ANDCAM TT,2(T)
IORM TT,2(D)
AOS TT,RELPGN#
DPB TT,[RPBYTE+2(D)]
MOVEI T,RLD
MOVEM T,RLDA#
CAMN B,DIRPAG
JRST DRGSET
JUMPE B,CPOPJ
CAMLE B,PAGES
POPJ P,
MOVEI DSP,RPDSP
SKIPN A,1(D)
JRST 4,.
PUSHJ P,SETI
;RDPAG2, RDPAG1, RDLINE, RDLLP, RDLTAB
TRNE F,FILLUZ
SKIPA T,[JSP Q,SOSTST]
RDPAG2: MOVE T,[SETZB B,TT]
MOVEM T,RDLINS#
HRRZ T,(D)
HRRZ T,1(T)
SUBI T,(A)
IMULI T,200*5
ADDM T,ROOM#
CAIG B,1
JRST RDPAG1
GETCHR
CAIE C,14
OUTSTR [ASCIZ /
DIRECTORY POINTER INVALID (NO PAGE MARK HERE) -- PROCEED WITH CAUTION
/]
RDPAG1: MOVSI H,LSPC+NSPEC
PUSHJ P,ENDSET
AOS T,A ;MAKE T +
MOVE G,INPNT
MOVEI D,PAGE#
MOVSI E,440700
HRRI E,LLDESC(A) ;SET UP FOR SSET2
ILDB C,G
SKIPGE CTAB(C)
XCT @CTAB(C)
DPB C,G ;IN CASE CLOBBERED BY SSET
ADD G,[70000,,]
CAIE C,12
JRST RDLINE
MOVEM G,NEWPNT
SOS IBLK
MOVE G,[441100,,[BYTE (9)15,200]]
RDLINE: HRRM A,(D)
LEG HRLZM D,(A)
RDLIN2: MOVSI E,440700
HRRI E,LLDESC(A)
XCT RDLINS ;SETZB B,TT OR JRST SOSTST
RDLLP: GETCH2 H,G
RDLLP2:
LEG IDPB C,E
AOJA B,RDLLP
RDLTAB:
LEG IDPB C,E
HRROI D,-10
IORI D,(B)
SUB B,D
ADDI TT,(D)
MOVEI T,40
JRST .+11(D)
REPEAT 10,<LEG IDPB T,E>
LEG IDPB C,E
AOJA TT,RDLLP
;RDLCR, RDLLF, NUMSTR,NUMSIX,OCTSTR,OCTASC
RDLCR0: MOVEI C,15
ADD G,[70000,,]
RDLCR: HRROI T,40
JUMPN B,.+2
LEG IDPB T,E
LEG IDPB C,E
GETCH2 H,G
RDLCR2: ADD G,[70000,,]
MOVEI C,12
RDLLF: JUMPGE T,RDLCR0
LEG IDPB C,E
TDZA C,C
LEG IDPB C,E
TLNE E,760000
JRST .-2
CAIL B,1000-2
JRST RDLONG
AOS LINES
ADDI TT,2(B)
ADDM TT,CHARS
DPB TT,[111100,,B]
HRRZM B,1(A)
AOS T,TXTNUM#
MOVEM T,2(A)
MOVEI D,(A)
MOVNI E,1(E)
ADDI E,LLDESC(A)
HRLI A,(E)
ADDI A,LLDESC+1
MOVEI T,1
IORM T,-1(A)
AOBJN A,.-1
MOVSI T,TXTCOD
FSFIX A,T
AOJA A,RDLINE
RDLONG: MOVE T,LLDESC(A)
CAME T,[ASCII /βββββ/]
CAMN T,[ASCID /βββββ/]
JRST RDLIN2
FATAL LINE MORE THAN 511 CHARS
NUMSTR: IDIVI T,=10 ;Converts to DEC ASCII, value in T, pointer in A
JUMPE T,.+4 ;Suppresses leading zeros
HRLM TT,(P)
PUSHJ P,NUMSTR
HLRZ TT,(P)
ADDI TT,"0"
IDPB TT,A
POPJ P,
OCTSTR: JUMPGE T,.+4
MOVEI TT,55
IDPB TT,A
MOVNS T
IDIVI T,10 ;Represents OCT in ASCII, value in T, pointer in A
JUMPE T,.+4 ;Suppresses leading zeros
HRLM TT,(P)
PUSHJ P,.-3
HLRZ TT,(P)
ADDI TT,"0"
IDPB TT,A
POPJ P,
OCTASC: PUSH P,C ;Represents OCTAL in ASCII, all zeros shown
MOVEI C,14 ;Value in TT, pointer in A
MOVEI T,0
LSHC T,3
ADDI T,"0"
IDPB T,A
SOJG C,.-4
POP P,C
POPJ P,
NUMSIX: IDIVI T,=10 ;Produces six-bit representation of DEC. value
JUMPE T,.+4
HRLM TT,(P)
PUSHJ P,NUMSIX
HLRZ TT,(P)
ADDI TT,'0'
IDPB TT,A
POPJ P,
;RDLFF, RDLDON, LINSET, RPDSP, RDLNUL
RDLFF: JUMPN B,RDLFF2
RDLDON: HRRZS CHARS
PUSHJ P,ENDFIX
HRLM D,BOTSTR
MOVEI T,BOTSTR
HRRM T,(D)
MOVEM G,INPNT
TRNN F,EDDIR
PUSHJ P,DIRCHK
TRNE F,FILLUZ
PUSHJ P,INSDIR
LINSET: MOVE T,LINES
CAMGE T,ARRL
TLOA F,OFFEND
TLZ F,OFFEND
SUB T,SCRSIZ
ADDI T,3
ADD T,EXTRA
JUMPG T,.+3
MOVEI T,1
SETOM BOTWIN
EXCH T,WINMAX#
CAMN T,WINMAX
CAIG T,1
SETOM BOTWIN
POPJ P,
RDLFF2: MOVEI C,15
LEG IDPB C,E
JRST RDLCR2
PUSHJ P,RLD1
RPDSP: JSP C,RDLNUL
PUSHJ P,@RLDA
JUMPGE T,RDLCR
JRST RDLLF
JUMPGE T,RDLTAB
JUMPGE T,RDLFF
MOVEI C,"}"
RDLNUL: SKIPE (G)
JRST -3(C)
HRLI G,700
SKIPN 1(G)
AOJA G,.-1
JRST -3(C)
;RDPGLZ, SOSTST, SOSCHK, SOSCK2, PGMK, PGMK2
RDPGLZ: ANDI A,-1
TRNE F,DIROK
JRST RDPGOK
PUSH P,B
PUSHJ P,RDPGOK
PUSHJ P,FLSPAG
POP P,A
JRST RDPAGE
SOSTST: SETZB B,TT
SOSCHK: GETCH2 H,G
SOSCK2: MOVEI T,1
AOS SOSBIN ;To count total references to SOSCK2
TDNN T,(G)
JRST 3(Q)
MOVE C,(G)
CAMN C,[ASCID / /]
JRST PGMK
AND C,[BYTE (7)160,160,160,160,160(1)1]
CAME C,[ASCID /00000/]
JRST [AOS SOSLI2↔JRST 2,@[20000,,(Q)]]
AOS SOSLIN
AOJA G,.+2
IBP G
SKIPGE (G)
PUSHJ P,RLD
JRST (Q)
PGMK: HRLI G,10700
AOS SOSPAG ;To count SOS pages
SKIPGE (G)
PUSHJ P,RLD
PGMK2: ILDB C,G
CAIN C,14
JRST @5(DSP)
CAIN C,15
JRST PGMK2
JRST 1(Q)
;DIRCHK, DIRNEW, DIRNW2, DIRNW1, TXTSHF
DIRCHK: MOVE A,INPNT
SUB A,IBFPNT
ADD A,[70000,,]
JUMPGE A,.+2
SUB A,[XOR 1]
ROT A,-7
HRR A,IBLK
HRRZ E,@DIRPT
SKIPN 1(E)
JRST DIRNEW
CAME A,1(E)
OUTSTR [ASCIZ /
NEXT DIRECTORY POINTER INVALID -- PROCEED WITH CAUTION
/]
POPJ P,
DIRNEW: TRNN F,EOF
JRST DIRNW1
TRO F,DIROK
DIRNW2: MOVEM A,1(E)
POPJ P,
DIRNW1: MOVE T,DIRPT
CAIE E,DIREND
JRST DIRNW2
PUSHJ P,DIRADD
JRST DIRCHK
TXTSHF: PUSHJ P,LSTSHF
MOVE T,2(A)
TLNE T,ARRBIT
ADDM C,ARRLIN
TLNE T,WINBIT
ADDM C,WINLIN
JUMPGE T,CPOPJ
ADDI A,LLDESC+LPMTXT
MOVE T,1(A)
TRNN T,-1
HRRI T,XPLSTE
PUSHJ P,LSTSH1
SUBI A,LLDESC+LPMTXT
POPJ P,
;FNDLIN, FNDPAG, FNDLN1, FNDLN2, FNDLN3
FNDLIN: SKIPA T,[LPTRTB,,LPTRT2]
FNDPAG: MOVE T,[DPTRTB,,DPTRT2]
HLRM T,FNDPT1
HRRM T,FNDPT2
MOVE T,-1(T)
HRLOI TT,377777
MOVEM TT,FNDTM1#
FNDLN1: MOVEI TT,(A)
SUB TT,@FNDPT1
MOVM TT,TT
CAMGE TT,FNDTM1
SKIPN @FNDPT2 ;IGNORE IF PNTR NOT SET
AOBJN T,FNDLN1
JUMPGE T,FNDLN2
MOVEM TT,FNDTM1
MOVEM T,FNDTM2#
AOBJN T,FNDLN1
FNDLN2: MOVE T,FNDTM2
MOVEI TT,(A)
SUB TT,@FNDPT1
ADD T,FNDPT2
XCT (T)
JUMPE TT,CPOPJ
JUMPL TT,FNDLN3
HRRZ T,(T)
SOJG TT,.-1
POPJ P,
FNDLN3: HLRZ T,(T)
AOJL TT,.-1
POPJ P,
;REMPTR, FIXPTR, FNDPT1, FNDPT2, LPTRTB, DPTRTB
;This AND's the complement of ARRBIT into the left half of (location in ARRLIN)+1
; if ARRLIN is non-zero and sets ARRLIN to zero
;Also AND's the complement of WIMBIT into the left half of (location in WINLIN)+1
; if WINLIN is non-zero and sets WINLIN to zero.
REMPTR: FOR @! X IN(ARR,WIN)
{ MOVSI TT,X!BIT
SKIPE T,X!LIN
ANDCAM TT,1(T)
SETZM X!LIN
} POPJ P,
;This fixes the pointers in the data for the line in question
; The location in ARRL is used by FINLIN to update ARRLIN and to compute the
; value which is ORed into the location 1 beyond that in ARRLIN.
; The location in WINL is similarly used to update WINLIN and to compute the
; value which is ORed into the location 1 beyond that in WINLIN.
FIXPTR: FOR @! X IN(ARR,WIN)
{ MOVE A,X!L
PUSHJ P,FNDLIN
MOVEM T,X!LIN
MOVSI TT,X!BIT
IORM TT,1(T)
} POPJ P,
IMPURE
FNDPT1: (T)
FNDPT2: @(T)
LPTRTB←←.
ARRL: 0
TOPWIN: 0
1
LINES: 0
LPTRTB-.,,
LPTRT2: HRRZ T,ARRLIN
HRRZ T,WINLIN
HRRZ T,PAGE
HLRZ T,BOTSTR
WINL←←TOPWIN ;FOR FIXPTR
DPTRTB←←.
CURPAG: 0
FIRPAG: 0
1
PAGES: 0
DPTRTB-.,,
DPTRT2: HRRZ T,DIRPT
HRRZ T,DIRP1
HRRZ T,DIR
HLRZ T,DIREND
PURE
;DIRGET, DIRGL, DGEND, DRGSET
DIRGET: HRRZ T,DIR
MOVEM T,DIRGPT# ;BETTER THE HELL NOT CAUSE SHUFFLAGE
SETZM DIRGPG#
MOVE C,[170700,,DIRHED+3]
MOVEM C,INPNT
MOVE C,PAGES
PUSHJ P,NUM5
MOVE C,[440700,,DIRHED]
JSP Q,RLDX
SKIPE VBUF
SKIPA C,[440700,,VBUF]
MOVE C,[440700,,[BYTE (7)15,12,177]]
JSP Q,RLDX
MOVE C,[440700,,DIRHD2]
DIRGL: JSP Q,RLDX
MOVE C,[350700,,DIRTXT]
MOVEM C,INPNT
MOVE C,DIRGPT
HRRZ C,1(C)
PUSHJ P,NUM5
IBP INPNT
AOS C,DIRGPG
CAMLE C,PAGES
JRST DGEND
PUSHJ P,NUM5
MOVE C,[440700,,DIRTXT]
JSP Q,RLDX
HRRZ C,DIRGPT
HRRZ Q,(C)
MOVEM Q,DIRGPT
ADD C,[440700,,LPDESC]
JRST DIRGL
DGEND: MOVEI C,177
IDPB C,INPNT
TRNN F,DIROK
SKIPA C,[440700,,DIRUNK]
MOVE C,[440700,,DIRTXT]
JSP Q,RLDX
MOVE C,[440700,,DIREMK]
JSP Q,RLDX
SUB P,[1,,1]
XCT -1(DSP)
DRGSET: MOVEI Q,DIRGET
TRO F,EDDIR
MOVEI DSP,DGDSP
PUSHJ P,SETRLD
MOVEI A,1
JRST RDPAG2
;NUM5, NUM5A, DIRHED, DIRTXT, DIREMK, DGDSP
NUM5: HRLI C,12*12*12*12*12/2
NUM5A: PUSH P,D
IDIVI C,12
TLNE C,-1
PUSHJ P,NUM5A
ADDI D,"0"
IDPB D,INPNT
POP P,D
POPJ P,
IMPURE
DIRHED: ASCII /COMMENT ⊗ VALID XXXXX PAGES/
BYTE (7)177
DIRHD2: ASCII /C REC PAGE DESCRIPTION
/
BYTE (7)177
DIRTXT: ASCII /Cxxxxx xxxxx/
BYTE (7)177
DIREMK: ASCII /ENDMK
C⊗;
/
BYTE (7)177
XDIRCH←←=77 ;# CHARS IN FIRST 2 & LAST LINES
VBUF: BLOCK 10
PURE
DIRUNK: ASCII /
AND WHO KNOWS HOW MANY MORE . . .
/
BYTE (7)177
JRST RDLDON
DGDSP: JSP C,[JRST -3(C)]
PUSHJ P,(Q)
JRST RDLCR
JRST RDLLF
JRST RDLTAB
JRST 4,.
JRST 4,.
;OUTDIR, OUTDOK, OUTDLP, ODDSP, ODDON, ODEXP
OUTDIR: TRNN F,REDNLY
SKIPN DIRPAG
POPJ P,
MOVE A,DIRSIZ
ADDI A,200*5-1+200*5 ;+1 TO GET REC #
IDIVI A,200*5
MOVEM A,NEWSIZ
HRRZ B,@DIR
HRRZ B,1(B) ;START OF PG 2
CAILE A,(B)
JRST ODEXP
OUTDOK: MOVEI E,EDFIL
PUSHJ P,OPENW
MOVEI A,1
PUSHJ P,SETO
MOVEI DSP,ODDSP
MOVEI Q,DIRGET
PUSHJ P,SETRLD
ODOLP: MOVE G,OPNT
MOVE E,OCNT
OUTDLP: GETCHR
IDPB C,G
SOJG E,OUTDLP
PUSHJ P,WRBUF
JRST ODOLP
JRST ODDON
ODDSP: JSP C,[JRST -3(C)]
PUSHJ P,(Q)
ODDON: MOVNI T,1
PUSHJ P,WRCHK
CAME T,DIRSIZ
FATAL DIRECTORY WRITER LOST
MOVEM T,ODSIZ
MOVEM G,OPNT
PUSHJ P,CLOSO
HRRZ T,@DIR
HRRZ T,1(T)
SUB T,NEWSIZ
JUMPLE T,CPOPJ
MOVE A,[OBUF-1,,OBUF]
BLT A,OBUF+177
PUSHJ P,WRBUF
SOJG T,.-1
POPJ P,
ODEXP: TRNE F,WRITE
JRST 4,.
MOVEI A,
JRST WRPX0
;INSDIR, DCLP1, DCLP2, DCNG, INSDL
INSDIR: TRNE F,EDDIR
POPJ P,
HRRZ D,PAGE
MOVE A,DIRP1
SKIPE XPAGES
JRST INSD3
INSD1: PUSH P,A
ADD D,[440700,,LLDESC]
MOVE T,1-LLDESC(D)
TRNN T,777000
JRST IDNUL
TRNN T,777
HRLI D,350700
MOVEI DSP,IDDSP
MOVE A,[440700,,T]
SETZB T,TT
MOVNI B,8
PUSH P,D
DCLP1: ILDB C,D
CAIL C,140
SUBI C,40
IDPB C,A
CAILE C,40
AOJL B,DCLP1
JUMPGE B,DCNG
MOVEI G,8+1(B)
MOVE H,CTAB(C)
TLNE H,LSPC
XCT IDDSP0-2(H)
DCLP1A: MOVSI B,-NSCOMS
DPB B,A
DCLP2: CAMN T,SCOMS(B)
CAME TT,SCOMS2(B)
AOBJN B,DCLP2
DCNG: POP P,T
JUMPL B,.+2
TDZA B,B
SKIPA B,G
MOVE D,T
MOVSI E,DSPC+LSPC+NSPEC
MOVE A,[700,,BUF-1]
MOVEI C,11
IDPB C,A
INSDL: ILDB C,D
TDNE E,CTAB(C)
XCT @CTAB(C)
IDPB C,A
AOJA B,INSDL
;IDDSP0, IDDSP, IDTAB, INSD3, INSD4, SCOMS, SCOMS2
IDDSP0: ADD D,[70000,,]
JRST 4,.
JRST IDTAB0
JRST 4,.
IDDSP: JRST 4,.
JRST 4,.
JRST IDDON
JRST 4,.
JRST IDTAB
JRST 4,.
JRST 4,.
JRST 4,.
AOJA B,INSDL
IDTAB0: SUBI G,8+1+1
IBP D
AOJL G,.-1
JRST DCLP1A
IDTAB: IDPB C,A
HRLS B
TLO B,-10
IBP D
AOBJN B,.-1
IBP D
JRST INSDL
INSD3: PUSHJ P,INSD1
TLO F,NOSHUF
HRRZ A,@DIRP1
HRRZ D,XPLST
INSD4: PUSH P,A
PUSH P,D
HRRZ D,-LLDESC-LPMTXT(D)
PUSHJ P,INSD1
POP P,D
POP P,A
HRRZ A,(A)
HRRZ D,(D)
JUMPN D,INSD4
TLZ F,NOSHUF
POPJ P,
SCOMS: ASCII/COMME/
ASCII/SUBTT/
NSCOMS←←.-SCOMS
SCOMS2: ASCII/NT/
ASCII/L/
;IDNUL, IDDON, IDDONS
IDNUL: MOVE A,[700,,BUF-1]
MOVEI C,15
IDDON: IDPB C,A
MOVEI B,1
FOR X IN(12,177){MOVEI C,X↔IDPB C,A↔}
TLNE A,760000
AOJA B,.-2
MOVEI E,-BUF+1(A)
MOVEI C,LPDESC(E)
IMULI E,5
SUB E,B
POP P,A
HRRZ T,2(A)
SUBM E,T
ADDM T,DIRSIZ
HLL E,2(A)
HRRZ B,-1(A)
CAIN C,-2(B)
JRST IDDONS
CAIL C,-2(B)
TLO F,NOCHK
MOVE B,C
PUSH P,1(A)
MOVE T,(A)
PUSH P,T
HRLM P,(T)
MOVS T,T
HRRM P,(T)
PUSHJ P,FSGIVE
TLZ F,NOCHK
PUSHJ P,FSGET
MOVSI T,DIRCOD
HLLM T,-1(A)
POP P,T
MOVEM T,(A)
HRLM A,(T)
MOVS T,T
HRRM A,(T)
POP P,1(A)
JUMPGE E,.+2
MOVEM A,DIRPT
TLNE E,D1BIT
MOVEM A,DIRP1
IDDONS: MOVEM E,2(A)
MOVSI T,BUF
HRRI T,LPDESC(A)
ADDI C,(A)
BLT T,-1(C)
POPJ P,
;DIRSET, DIRST1, DIRUP, DIRUP1, DIRUP2, DIRUP3
DIRSET: HRRZ A,DIRP1
HRRZ T,1(A)
DIRST1: HLLZ TT,1(B)
ROT TT,8
TLNE TT,-1
ADDI TT,1
ADDI T,(TT)
HRRZ A,(A)
CAME T,1(A)
TRO F,UPDIR
MOVEM T,1(A)
HRRZ B,(B)
JUMPN B,DIRST1
POPJ P,
DIRUP: SKIPN B,DPLST#
JRST DIRUP2
DIRUP1: MOVEI A,(B)
HRRZ B,(A)
PUSHJ P,FSGIVE
CAIE B,DPLST
JRST DIRUP1
SETZM DPLST
DIRUP2: HRRZ A,DIRP1
MOVEI B,1
DIRUP3: DPB B,[RPBYTE+2(A)]
SKIPGE 2(A)
POPJ P,
HRRZ A,(A)
AOJA B,DIRUP3
;DIRFIX, DIRFX1, DIRFX2, DIRFX3, DIRFX4, DIRFXN
DIRFIX: HRRZ A,DIRP1
TLO F,NOSHUF
SKIPN B,DPLST
JRST DIRFX4
DIRFX1: HLLZ T,2(A)
TLNN T,RPMASK
PUSHJ P,DIRFXN
TLZ T,¬RPMASK
CAML T,2(B)
JRST DIRFX3
SKIPGE 2(A)
JRST DIRFX2
HRRZ A,(A)
JRST DIRFX1
DIRFX2: MOVSI T,DPBIT
ANDCAM T,2(A)
IORM T,2(B)
HRRZM B,DIRPT
HRRZ A,(A)
DIRFX3: HLL A,(A)
HRRZ T,(B)
MOVEM A,(B)
HRLM B,(A)
MOVS A,A
HRRM B,(A)
HRRZ A,2(B)
ADDI A,=12
ADDM A,DIRSIZ
AOS CURPAG
AOS PAGES
MOVEI A,(B)
MOVEI B,(T)
CAIE B,DPLST
JRST DIRFX1
SETZM DPLST
DIRFX4: HLLZ T,2(A)
TLNN T,RPMASK
PUSHJ P,DIRFXN
HRRZ A,(A)
JUMPGE T,DIRFX4
TLZ F,NOSHUF
POPJ P,
DIRFXN: PUSHJ P,DELPG1
HLRZ C,(A)
PUSHJ P,FSGIVE
MOVEI A,(C)
HLLZ T,2(A)
POPJ P,
;DISPLAY DATA STORAGE
IMPURE
;DPY is E's opinion of what type of display the user is on. (See first page for
;definition of display types)
DPY: 0
NLINES: =40
=42
SCRTOP: 2
PPSIZ: 3
LINMAX: =21+2+LLDESC
ARRPOS: 0 ;TTY
CW 1,46,3,1,3,1 ;DD
BYTE(11)<-24>,0(3)0,0(2)0,2(4)6 ;III
AR2POS: 0 ;TTY
CW 1,66,3,1,3,1 ;DD
BYTE (11)<-24>,0(3)0,0(2)0,2(4)6 ;III
ARPOS2: 0 ;TTY
CW 1,46,3,1,3,1 ;DD
BYTE (11)<-14>,0(3)0,0(2)0,2(4)6 ;III
ARRBUF: BLOCK 5
;This is the one of FW's winning tables which is accessed with DPY-1
FIRWRD: CW 1,46,2,0,3,2
0
DISPI: 0
JRST TDISP ;TTY
PPINFO RBUF ;DD
PPINFO RBUF ;III
WIPI: 0
POPJ P, ;TTY
PUSH P,A ;DD
JRST IWIPE ;III
DBLTI: 0
LDB T,[300700,,DPYTAB(G)]
JRST DBLT2
PCOMP: POPJ P, ;TTY - MUST BE REASONABLE INSTR
JRST PCOMPD ;DD
JRST PCOMPI ;III
P2COMP: POPJ P, ;TTY - MUST BE REASONABLE INSTR
JRST P2CMPD ;DD
JRST P2CMPI ;III
;MORE DISPLAY STORAGE
DISPXA: 0 ;TTY
DDISPX ;DD
IDISPX ;III
DISP1A: 0 ;TTY
DDISP ;DD
IDISP ;III
DISP2I: 0
TRNE F,EDITM
JRST DISP3
LEPREP: 0 ;TTY
PUSHJ P,LEADJ ;DD
JFCL ;III
LETST: 0
CAIG T,=84
JFCL
SPCOUT: 0
PUSH H,[CW 1,46,1,46,1,46]
JFCL
DPYHED: SETZ DPYBUF
0
DDACT: 0
DPYBUF: BLOCK DPYBSZ
100,,
DPYTAB: BLOCK MAXLIN
DPYLOC: BLOCK MAXLIN
MASK: 0
CW(0,377,7,0,0,377)+3
BYTE(11)3777,0(3)7,0(2)3,0(4)17
BRKTAB: BLOCK 4
;HEADERS & TRAILERS
LTPSTR+2
TOPSTR: BLOCK 2
,-1
ASCID/************ PAGE /
HEDPAG: BLOCK 1
HEDNAM: BLOCK 6
ROFLG: BLOCK 1
ASCID/ ************ /
WFLAG: BLOCK 1
ASCID /
/
LTPSTR←←.-TOPSTR
LTPDSH+2
TOPDSH: BLOCK 2
,-2
ASCID/---- PAGE /
HED2PG: BLOCK 1
HED2NM: BLOCK 6
ROFLG2: BLOCK 1
ASCID/ ---- /
WFLAG2: BLOCK 1
ASCID /
/
LTPDSH←←.-TOPDSH
LBTSTR+2
BOTSTR: .
0
,-3
ASCID/************************
/
LBTSTR←←.-BOTSTR
PURE
LBTDSH+2
BOTDSH: BLOCK 2
,-4
ASCID/--------
/
LBTDSH←←.-BOTDSH
LDOTS+2
DOTS: BLOCK 2
,-5
ASCID / . . .
/
LDOTS←←.-DOTS
;DPYINI, DPYCHK
DPYINI: SETOM TTYNUM
SETOM DPY
MOVEI T,"→"*2+1
MOVEM T,ARRON#
DPYCHK: PUSH P,A
MOVNI A,1
GETLIN A
MOVEI DSP,
TLNE A,DD
MOVEI DSP,1
TLNE A,III
MOVEI DSP,2
HRRZS A
CAMN A,TTYNUM
JRST POPAJ
TRO F,DSPALL
CAMN DSP,DPY
JRST POPAJ
PUSH P,B
PUSH P,T
PUSH P,TT
MOVEM DSP,DPY
MOVEM A,TTYNUM#
MOVE T,WIPI+1(DSP)
MOVEM T,WIPI
MOVE T,DISPI+1(DSP)
MOVEM T,DISPI
SETZM LSTARR#
SETZM LSTPAG#
SOJL DSP,NODPY ;Decrement display type and jump if TTY
SETACT [BRKTAB,,]
MOVEI T,SUPCCR
IORM T,BRKTAB+3
;The following is a temporary insertion
; MOVE T,[360,,000000] ;Activation on LF,VT,FF,CR
; MOVEM T,BRKTAB
; SETZM BRKTAB+1 ;Accept most special characters
; SETZM BRKTAB+2
; MOVE T,[000001,,000006] ;Activation on ALT and all αβ controls
; MOVEM T,BRKTAB+3 ;and disable α<CR> returning last line
; SETOM T ;Nessary for GETLIN to work properly
; GETLIN T
; TLO T,100
; SETLIN T ;Enter special activation mode
;A SAMPLE LINE TO TEST EFFECT OF THE ABOVE ON INSERTION OF 'S.
;End of temporary insertion
SETACT [BRKTAB]
;At this point, DSP contains one less than display type
MOVE T,FIRWRD(DSP)
MOVEM T,DPYBUF
FOR X IN(ARRPOS,AR2POS,PCOMP,P2COMP,DISPXA,DBLTI,LEPREP,DISP1A,<DISP2I>
,LETST,SPCOUT,ARPOS2,MASK)
{ MOVE T,X+1(DSP)
MOVEM T,X
}
;DPYI2, NODPY, WIPE, IWIPE
DPYI2: MOVE G,NLINES(DSP)
SUB G,PPSIZ
MOVEM G,PPPOS#
PUSHJ P,P2COMP
HRRZM T,DPPPOS#
MOVE T,PPSIZ
LSH T,9
TRO T,1
MOVEM T,DPPSIZ#
PUSHJ P,PPSET
MOVE B,PPPOS
MOVE A,SCRTOP
SUB B,A
PUSHJ P,SETSCR
MOVE T,[DPYTAB-1,,DPYTAB]
BLT T,DPYTAB+MAXLIN-1
TRO F,DSPALL
PUSHJ P,WIPE
POP P,TT
POP P,T
JRST POPBAJ
NODPY: SKIPL SRCFIL+1
JRST NODPY2
OUTSTR [ASCIZ /EDITING /]
MOVEI D,EDFIL
PUSHJ P,FILTYP
TYPCHR "
"
NODPY2: OUTSTR[ASCIZ /UGH, NO DISPLAY. GOOD LUCK!
/]
AOJA DSP,DPYI2
WIPE: XCT WIPI
PUSH P,B
MOVE H,[-DPYBSZ+1,,DPYBUF]
PUSH H,POSWRD
SETZM BLNKL
SKIPE DDACT
DPYOUT [0↔0]
MOVE G,SCRTOP
PUSHJ P,WIPIT
PUSHJ P,DDCOP ;CAN'T POSSIBLY SKIP
MOVEI G,10000
IORM G,DPYBUF+1(TT)
MOVE B,TT
MOVEI H,DPYBUF-1-1(T)
PUSHJ P,DDCOP
MOVEI G,20000
ADDM G,DPYBUF+1(TT)
ADD TT,B
ADDM G,DPYBUF+1(TT)
SETOM OLDARR
JRST DISPX
IWIPE: PGCLR
POPJ P,
;SETSCR, NMVARR, MOVARR, SETARR
SETSCR: MOVEM A,SCRTOP
MOVEM B,SCRSIZ#
LSH B,-1
SOJ B,
MOVEM B,GTDEL#
SETZM BLNKL
MOVE G,A
PUSHJ P,PCOMP
MOVEM T,POSWRD#
SKIPN PAGE
POPJ P,
PUSHJ P,LINSET
MOVEI A,1
JRST SETWIN
TRC T,SBKWDS
NMVAR1: AOS (P)
NMVARR: MOVNS A
MOVARR: ADD A,ARRL
SETARR: MOVE T,LINES
CAIGE A,1
MOVEI A,1
CAILE A,1(T)
MOVEI A,1(T)
CAILE A,(T)
TLOA F,OFFEND
TLZ F,OFFEND
PUSHJ P,FNDLIN
MOVEM A,ARRL
CAME A,SRCL
SETZM SRCOFF
MOVSI TT,ARRBIT
EXCH T,ARRLIN#
JUMPE T,.+2
ANDCAM TT,1(T)
MOVE T,ARRLIN
IORB TT,1(T)
TLNE TT,PMARK
TLOA F,PMLIN
TLZ F,PMLIN
TRNE TT,777
TLZA F,NULLIN
TLO F,NULLIN
POPJ P,
;ARRBOT, ARRTOP, SETWIN, WINCHK, WINCH2
ARRBOT: SUB A,SCRSIZ
ADDI A,3+4+4
ARRTOP: SUBI A,4
SETWIN: CAMLE A,WINMAX
MOVE A,WINMAX
CAIG A,1
SKIPA A,[1]
SKIPA B,[TOPDSH]
MOVEI B,TOPSTR
MOVEM B,HEDBLK#
CAME A,WINMAX
SKIPA B,[BOTDSH]
MOVEI B,BOTSTR
MOVEM B,TRLBLK#
CAME A,TOPWIN
TRO F,DSPSCR
PUSH P,A
ADD A,SCRSIZ
SUB A,EXTRA
SUBI A,3
CAMLE A,LINES
MOVE A,LINES
AOJ A,
MOVEM A,BOTWIN#
POP P,A
MOVEI T,-1(A)
SUB T,SCRTOP
MOVNM T,OFFSET#
PUSHJ P,FNDLIN
MOVEM A,TOPWIN
MOVSI TT,WINBIT
SKIPE B,WINLIN
ANDCAM TT,1(B)
MOVEM T,WINLIN#
IORM TT,1(T)
POPJ P,
WINCHK: MOVE A,ARRL
CAMGE A,TOPWIN
JRST ARRTOP
WINCH2: CAML A,BOTWIN
JRST DWNWIN
POPJ P,
;DISP, DISP0, DISP1, DISP2
DISP: PUSH P,A
PUSH P,B
TRNN F,EDITM
PUSHJ P,LECLR
PUSHJ P,WINCHK
XCT @-2(P)
AOSA -2(P)
JRST PPBAJ1
XCT DISPI ;PPINFO RBUF OR JRST TDISP
MOVE T,RBUF+2
TLNE T,200000
TRO F,DSPALL
HLRZ T,RBUF+3+1
TRNE T,2000
IORI T,-2000
CAIN T,@DPPPOS
SOSE RBUF+1
TROA F,DSPALL
JRST .+2
PUSHJ P,PPSET
MOVE H,[-DPYBSZ+1,,DPYBUF]
MOVE T,[2200,,RBUF-1]
MOVEM T,POSLST#
TRNN F,DSPALL
JRST @DISP1A
SKIPE DDACT
DPYOUT [0↔0]
DISP2: MOVE G,SCRTOP
PUSH H,POSWRD
IDPB H,POSLST
HRRZM H,DPYLOC(G)
MOVE A,HEDBLK
MOVEI B,1
PUSHJ P,DBLT
MOVE B,ARRL
SUB B,TOPWIN
MOVE A,WINLIN
JUMPLE B,.+2
PUSHJ P,DBLT
TRNE F,ATTMOD
JRST DISPAT
XCT DISP2I
SKIPA T,AR2POS
MOVE T,ARRPOS
PUSH H,T
MOVE T,ARRON
PUSH H,T
DPB T,[271000,,DPYTAB(G)]
;FALLS THRU
;DISP3, DISP4, DISP5, DUMMY, EXCLR, EXSET,EXTST
DISP3: TRNE F,EDITM
JRST DISP5
DISP3A: TLNE F,OFFEND
JRST [MOVE A,TRLBLK↔PUSHJ P,DBLT2↔JRST @DISPXA]
PUSHJ P,DBLT2
DISP4: MOVE B,BOTWIN
SUB B,ARRL
PUSHJ P,DBLT3
MOVE A,TRLBLK
PUSHJ P,DBLT
JRST @DISPXA
DISP5: PUSHJ P,LESET
XCT SPCOUT
PUSH H,[ASCID /
/]
HLLZS DPYTAB(G)
AOJ G,
HRRZM H,DPYLOC(G)
MOVEM G,DPYCLB#
MOVEI A,DUMMY
SKIPE B,EXTRA
PUSHJ P,DBLT
XCT SPCOUT
TLNE F,OFFEND
JRST @DISPXA
HRRZ A,@ARRLIN
JRST DISP4
LLDESC+1+2
DUMMY: .,,.
2000
,-5
ASCID /
/
EXTST: XCT LETST
EXCLR: TDZA T,T
MOVEI T,1
EXSET: CAMN T,EXTRA
POPJ P,
MOVEM T,EXTRA#
TRO F,DSPSCR
MOVSI TT,WINBIT
SKIPE T,WINLIN
ANDCAM TT,1(T)
SETZM WINLIN
SETOM BOTWIN
JRST LINSET
;DISPAT, DISPAX
DISPAT: HRRZ A,ATTBUF#
MOVE B,ATTNUM#
CAILE B,ATTMAX
MOVEI B,ATTMAX/2
PUSH P,DBLTI
MOVE T,[JRST DBLT4]
MOVEM T,DBLTI
PUSH P,ARRPOS
MOVE T,ARPOS2
MOVEM T,ARRPOS
PUSHJ P,DBLT
MOVE T,ATTNUM
CAIG T,ATTMAX
JRST DISPAX
PUSH H,ARRPOS
MOVE T,[ASCID / . /]
PUSH H,T
DPB T,[271000,,DPYTAB(G)]
PUSH H,[ASCID /. .
/]
AOJ G,
HRRZM H,DPYLOC(G)
MOVSI B,-ATTMAX+ATTMAX/2+1
MOVEI A,ATTBUF
HLRZ A,(A)
AOBJN B,.-1
PUSHJ P,DBLT
DISPAX: POP P,ARRPOS
POP P,DBLTI
TLNE F,OFFEND
SKIPA A,TRLBLK
HRRZ A,ARRLIN
PUSHJ P,DBLT
TLNE F,OFFEND
JRST @DISPXA
JRST DISP4
;DWNWIN, REWIN, DDISPX, DDSPX2, DDDONE, WIPIT, WIPL, WIPL2
DWNWIN: CAMLE A,LINES
SOJA A,WINCH2
SKIPGE T,BOTWIN
JRST REWIN
SUBI A,(T)
ADD A,TOPWIN
ADDI A,4
JRST SETWIN
REWIN: MOVE A,TOPWIN
PUSHJ P,SETWIN
MOVE A,ARRL
JRST WINCH2
DDISPX: PUSHJ P,WIPIT
MOVE A,ARRL
ADD A,OFFSET
MOVEM A,OLDARR
DDSPX2: MOVEI T,
IDPB T,POSLST
PUSHJ P,DDCOP
JRST DDDONE
DPYOUT DPYHED
DPYOUT [0↔0]
DDDONE: PUSHJ P,LINREL
TRZ F,DSPSCR+DSPALL
SKIPE T,DPYCLB
HLLZS DPYTAB(T)
SETZM DPYCLB
JRST DISPX
WIPIT: MOVE T,G
SUB T,SCRTOP
SUB T,SCRSIZ
SUB T,BLNKL
ADDM T,BLNKL#
JUMPGE T,CPOPJ
HRL G,T
WIPL: MOVSI T,40
EXCH T,DPYTAB(G)
TLNN T,17700
JRST WIPL2
PUSH H,ARRPOS
WIPL2: PUSH H,[ASCID /
/]
AOBJN G,WIPL
POPJ P,
;DDCOP, DDLUZ, LINREL, LINRLL, IDISP, IDISP2
DDCOP: MOVEI TT,-DPYBUF(H)
CAIL TT,DPYBSZ/2-1
JRST DDLUZ
AOS T,H
HRLI H,DPYBUF+1
LSH T,1
SUBI T,DPYBUF+1
BLT H,-1(T)
SETZM (T)
SUBI T,DPYBUF-1
HRRZM T,DPYHED+1
POPJ P,
DDLUZ: SETZB TT,1(H)
SUBI H,DPYBUF-1-1
HRRZM H,DPYHED+1
JRST POPJ1
LINREL: MOVEI G,10000
MOVE T,[2200,,RBUF-1]
LINRLL: ILDB H,T
JUMPE H,CPOPJ
ADDI H,(TT)
ADDM G,(H)
JRST LINRLL
IDISP: TRNE F,DSPSCR
JRST DISP2
TRNE F,ATTMOD
JRST IDISP2
PUSHJ P,IIIARR
JRST POPBAJ
IDISP2: MOVE G,ARRL
ADD G,OFFSET
CAME G,OLDARR
JRST DISP2
JRST POPBAJ
;IIIARR, IIIAR2, IIIAR3
IIIARR: MOVE G,ARRL
ADD G,OFFSET
MOVEM G,OLDARR
TRNN F,EDITM!ATTMOD
JRST IIIAR2
TRNE F,ATTMOD
JRST [MOVNI G,20↔JRST IIIAR2]
PUSHJ P,LESET
JFCL
TLNE F,NULLIN
TLNE F,OFFEND
JRST IIIAR3
IIIAR2: PUSHJ P,PCOMPI
TLOE F,ARRPG
JRST IIIAR4
MOVEM T,ARRBUF+1
MOVE T,ARRPOS
MOVEM T,ARRBUF+2
MOVE T,ARRON
MOVEM T,ARRBUF+3
DPYOUT 1,[ARRBUF↔5]
POPJ P,
IIIAR3: TLZE F,ARRPG
PGSEL 0
HRRZ TT,DPYLOC(G)
MOVE T,[ASCID /
/]
UPGMVM T,1(TT)
HRRZ T,DPYLOC+1(G)
CAIN T,1(TT)
JRST IIIAR2
MOVSI T,1(T)
HRRI T,20
UPGMVM T,2(TT)
JRST IIIAR2
IIIAR4: UPGMVM T,ARRBUF+1
MOVE T,ARRON
CAME T,ARRBUF+3
UPGMVM T,ARRBUF+3
MOVEM T,ARRBUF+3
POPJ P,
;LESET, LEADJ, LECLR
;Note skip return
LESET: PUSHJ P,P2COMP
ADDI T,4000
CAMN T,LEPOS
JRST POPJ1
MOVEM T,LEPOS#
LEYPOS (T)
TLNN F,NULLIN
AOSA (P)
INSKIP
POPJ P,
JRST POPJ1
LEADJ: SKIPE LEPOS
POPJ P,
MOVE G,ARRL
ADD G,OFFSET
PUSHJ P,LESET
POPJ P,
POPJ P,
LECLR: SKIPE LEPOS
LEYPOS
SETZM LEPOS
POPJ P,
;DBLT, DBLT1, DBLT2, DBLT3, IDISPX, DISPX, PPBAJ1, POPBAJ, POPAJ
DBLT: XCT DBLTI
JUMPE T,DBLT2
MOVE T,[ASCID / /]
DBLT1: PUSH H,ARRPOS
PUSH H,T
DPB T,[271000,,DPYTAB(G)]
DBLT2: HRRZ T,2(A)
HRRM T,DPYTAB(G)
HRRZ TT,-1(A)
SKIPGE 1(A)
SUBI TT,2
CAMLE TT,LINMAX
HRRO TT,LINMAX
MOVSI T,LLDESC(A)
HRRI T,1(H)
ADDI H,-2-LLDESC(TT)
BLT T,(H)
JUMPGE TT,.+2
PUSH H,[ASCID /
/]
AOJ G,
HRRZ A,(A)
HRRZM H,DPYLOC(G)
DBLT3: SOJG B,DBLT
POPJ P,
DBLT4: MOVEI T,"|"*2+1
JRST DBLT1
IDISPX: PUSHJ P,IIIARR
TRZ F,DSPSCR+DSPALL
SETZM 1(H)
SUBI H,DPYBUF-1-1
HRRZM H,DPYHED+1
DISPX: DPYOUT DPYHED
TLZA F,ARRPG
PPBAJ1: AOS -2(P)
POPBAJ: POP P,B
POPAJ: POP P,A
POPJ P,
;PCOMPD, PCOMPI, PCOMPS, P2CMPD, P2CMPI
PCOMPD: MOVEI T,14
IMUL T,G
DPB T,[400400,,T]
TRZ T,17
ROT T,20
TRO T,<CW 4,0,4,0,5,0>
POPJ P,
PCOMPI: MOVE T,[-30⊗16]
IMUL T,G
ADD T,[BYTE(11)<-1000>,770(3)2,2(2)1,2(4)6]
POPJ P,
PCOMPS: PUSHJ P,PCOMPD
PUSH H,T
IDPB H,POSLST
POPJ P,
P2CMPD: MOVEI T,1(G)
LSH T,7
IDIV T,[-5]
ADDI T,1000
POPJ P,
P2CMPI: MOVEI T,(G)
IMUL T,[-30]
ADDI T,770
POPJ P,
;DDISP, DDISP2
DDISP: TRNE F,DSPSCR
JRST DDISPS
MOVE A,ARRL
ADD A,OFFSET
CAMN A,OLDARR
JRST DDISP2
TRNE F,ATTMOD
JRST DDISPS
EXCH A,OLDARR#
PUSH P,A
HRROI B,OFFARR
CAML A,OLDARR
HRROI B,ONARR
SUB A,OFFSET
PUSHJ P,FNDLIN
PUSH P,T
SKIPE DDACT
DPYOUT [0↔0]
PUSHJ P,DOARR
TRC B,OFFARR≠ONARR
PUSHJ P,DOARR
SUB P,[2,,2]
JRST DDSPX2
DDISP2: TRNN F,EDITM
JRST POPBAJ
SKIPE DDACT
DPYOUT [0↔0]
MOVE G,A
PUSHJ P,DOAR2
JRST POPBAJ
;DOARR, DOAR2, OFFARR, ONARR
DOARR: SKIPGE G,@(B)
POPJ P,
PUSHJ P,PCOMPS
TRNE F,EDITM
SKIPL 1(B)
SKIPA T,ARRPOS
MOVE T,AR2POS
PUSH H,T
MOVE T,@2(B)
PUSH H,T
DPB T,[271000,,DPYTAB(G)]
MOVE A,@1(B)
TRNE F,EDITM
SKIPL 1(B)
AOJA B,DBLT2
DOAR2: PUSHJ P,LESET
PUSH H,[CW 1,46,1,46,1,46]
PUSH H,[ASCID /
/]
HLLZS DPYTAB(G)
AOJ G,
MOVEM G,DPYCLB
POPJ P,
OFFARR: ,-2(P) ;BOY DOES FAIL EVER EAT IT!
,-1(P)
[ASCID/ /]
ONARR: OLDARR
SETZ ARRLIN
ARRON
;DDISPS, DDSPS2, DDSPS3, DDSPSX, DDSPS4
DDISPS: MOVE G,SCRTOP
PUSH P,C
PUSH P,D
SETOB C,D
SKIPE DDACT
DPYOUT [0↔0]
MOVE A,HEDBLK
HRROI B,[ASCID/ /]
PUSHJ P,DBLTS
MOVE C,ARRL
SUB C,TOPWIN
MOVE A,WINLIN
JUMPLE C,.+2
PUSHJ P,DBLTS
HRROI B,ARRON
TRNE F,EDITM!ATTMOD
JRST DDSPS4
DDSPS2: TLNE F,OFFEND
JRST DDSPSX
PUSHJ P,DBLTS
HRROI B,[ASCID / /]
DDSPS3: MOVE C,BOTWIN
SUB C,ARRL
PUSHJ P,DBLTS3
DDSPSX: MOVE A,TRLBLK
PUSHJ P,DBLTS
POP P,D
POP P,C
JRST DDISPX
DDSPS4: TRNE F,ATTMOD
JRST DSPSAT
PUSHJ P,LESET
SKIPA TT,ARRPOS
MOVE TT,AR2POS
PUSH P,TT
PUSH P,D
PUSHJ P,DBLTA
MOVEM G,DPYCLB
HRROI B,[ASCID / /]
SKIPE C,EXTRA
PUSHJ P,DBLTA
POP P,T
CAME T,D
PUSH H,[CW 1,46,1,46,1,46]
SUB P,[1,,1]
TLNE F,OFFEND
JRST DDSPSX
HRRZ A,(A)
JRST DDSPS3
;DSPSAT, DSPSAX
DSPSAT: HRRZ A,ATTBUF
MOVE C,ATTNUM
CAILE C,ATTMAX
MOVEI C,ATTMAX/2
HRROI B,["|"*2+1]
PUSHJ P,DBLTS
MOVE T,ATTNUM
CAIG T,ATTMAX
JRST DSPSAX
HRROI B,[ASCID / /]
MOVEI A,DOTS
PUSHJ P,DBLTS
MOVSI C,-ATTMAX+ATTMAX/2+1
MOVEI A,ATTBUF
HLRZ A,(A)
AOBJN C,.-1
HRROI B,["|"*2+1]
PUSHJ P,DBLTS
DSPSAX: HRRZ A,ARRLIN
HRROI B,[ASCID / /]
JRST DDSPS2
;DBLTS, DBLTS2, DBLTSN, DBLTS3, DBLTS1, DBLTSA, DBLTA, DBLTA2
DBLTS: LDB T,[271000,,DPYTAB(G)]
CAIE T,@(B)
JRST DBLTS1
HRRZ T,2(A)
CAIN T,@DPYTAB(G)
AOJA G,DBLTSN
CAIE G,(D)
PUSHJ P,PCOMPS
DBLTS2: PUSHJ P,DBLT2
AOJ B,
SKIPA D,G
DBLTSN: HRRZ A,(A)
DBLTS3: SOJG C,DBLTS
POPJ P,
DBLTS1: PUSHJ P,DBLTSA
PUSH H,ARRPOS
JRST DBLTS2
DBLTSA: CAIE G,(D)
PUSHJ P,PCOMPS
XCT @(P)
MOVE T,(B)
PUSH H,T
DPB T,[271000,,DPYTAB(G)]
JRST POPJ1
DBLTA: LDB T,[271000,,DPYTAB(G)]
CAIN T,@(B)
AOJA G,DBLTA2
PUSHJ P,DBLTSA
PUSH H,-3(P)
PUSH H,[ASCID /
/]
AOS D,G
DBLTA2: HLLZS DPYTAB(G)
SOJG C,DBLTA
POPJ P,
;TDISP, TDISP1, TDISP2, TDSP2A, TDISPX
TDISP: PUSHJ P,TDISP0
TRZ F,DSPSCR!DSPALL
JRST POPBAJ
TDISP0: SETZM TYOPNT
PUSHJ P,GPAGL
HLRZ TT,T
ANDI T,-1
CAMN T,LSTPAG
JRST TDISP5
MOVEM T,LSTPAG
OUTSTR [ASCIZ /PAGE /]
TYPDEC LSTPAG
OUTSTR [ASCIZ /
/]
TDISP1: MOVEM TT,LSTARR
MOVE A,ARRLIN
SKIPL T,1(A)
CAIN A,BOTSTR
JRST TDISP4
TYPDEC LSTARR
TYPCHR 11
TRNN T,777
TLOA A,350700
HRLI A,440700
ADDI A,LLDESC
TDISP2: ILDB T,A
CAIGE T,40
JRST TDSP2A
TYPCHR (T)
JRST TDISP2
TDSP2A: CAIL T,11
CAILE T,15
JRST TDISPC
TYPCHR (T)
CAIN T,11
JRST TDISP3
CAIE T,12
JRST TDISP2
POPJ P,
;TDISPC, TDISP3, TDISP4, TDISP5, TYPE, TYPEL
TDISPC: TYPCHR "↑"
TYPCHR 100(T)
JRST TDISP2
TDISP3: ILDB T,A
CAIE T,11
JRST TDISP3
JRST TDISP2
TDISP4: JUMPL T,.+2
SKIPA T,[[ASCIZ /END OF PAGE)
/]]
MOVEI T,[ASCIZ /PAGE MARK)
/]
TYPCHR "("
TYPDEC LSTARR
TYPCHR 11
OUTSTR (T)
POPJ P,
TDISP5: CAMN TT,LSTARR
TRNE F,DSPSCR!DSPALL
JRST TDISP1
POPJ P,
TYPE: TRNN F,ARG
IMULI A,=10
PUSHJ P,ARGCHK
SKIPG D,A
POPJ P,
TYPEL: PUSHJ P,TDISP0
MOVEI A,1
PUSHJ P,MOVARR
SOJG D,TYPEL
POPJ P,
;WRPAGE, WRPAG1, WRPAG2, WRBOOK
;WRPAGE is entered whenever it is necessary to update the disk record.
;It is entered on specific command via CMDSP.
;PUSHJ entries are from READON: FINISH: NEWPG0: FIND:
;JRST entry from DELET1:
WRPAGE:
TRNE F,WRITE
TRNE F,EDDIR
JRST CLRWRT
TRNE F,REDNLY
JRST WRRDO
JFCL WRPAGE ;To report location WRPAGE in CHECKU
PUSHJ P,CHECKU
WRPAG1: TRNE F,UPDTXT
PUSHJ P,INSDIR
TRNE F,UPDIR
PUSHJ P,DIRUP
SKIPE B,XPLST
PUSHJ P,DIRSET
MOVE A,CHARS
ADDI A,200*5-1
IDIVI A,200*5
MOVEM A,NEWSIZ#
HRRZ C,@DIRPT
MOVE B,1(C)
HRRZ T,DIRP1
SUB B,1(T)
MOVEM B,OLDSIZ#
SUBI A,(B)
SKIPN DIRPAG
JRST WRPAG2
HRRZ TT,@DIR
MOVE TT,1(TT)
SOJ TT,
IMULI TT,200*5
CAMGE TT,DIRSIZ
JRST WRPX0 ;DIRECTORY GREW
WRPAG2: JUMPLE A,WRPOK
MOVE TT,CURPAG
CAMGE TT,PAGES
JRST WRPX
MOVEI TT,(A)
ADDB TT,DIREND+1
SOJ TT,
CAMG TT,FILLEN
SKIPA TT,FILLEN
MOVEM TT,FILLEN
LSH TT,7
MOVEM TT,FILWC
IMULI A,200*5
ADDM A,ROOM
TRO F,UPDIR
TRZ F,XPAGE
PUSHJ P,WRTIT ;NO SHUFFLE IF LAST PAGE
MTAPE DSKO,['GODMOD'↔17]
POPJ P,
IFN BOOKMD, {
WRBOOK: OUTSTR [ASCIZ /
SORRY -- /]
OUTSTR [ASCIZ \CANNOT ALTER FILE WHEN IN /B MODE. \]
POPJ P,
};END BOOKMD
;WRPX0, WRPX, WRPX1, WRPX1A, WRPX1B, WRPX2
WRPX0: TRO F,XPAGE
WRPX: TRNN F,XPAGE
JRST 4,.
OUTSTR [ASCIZ / RIPPLING /]
; OUTSTR [ASCIZ /BUBBLING
;/]
IMULI A,200*5
ADDM A,ROOM
MOVEI I,1
SKIPN A,DIRPAG
JRST WRPX1A
MOVE A,DIRSIZ
ADDI A,200*5-1+200*5
IDIVI A,200*5
HRRZ B,@DIR
MOVE I,1(B)
SUBI A,(I)
MOVN C,DIRPAG
TRNN F,WRITE
JRST WRPX1B ;FROM OUTDIR
ADD C,CURPAG
JUMPLE C,WRPX1A
WRPX1: ADDM A,1(B)
HRRZ B,(B)
SOJG C,WRPX1
WRPX1A: ADD A,NEWSIZ
SUB A,OLDSIZ
HRRZ B,@DIRPT
HRL I,1(B)
MOVN C,CURPAG
WRPX1B: ADD C,PAGES
WRPX2: ADDM A,1(B)
HRRZ B,(B)
SOJGE C,WRPX2
;WRPX3, WRPX4
WRPX3: PUSHJ P,COPCOR
MOVEI D,EDFIL
PUSHJ P,OPENI
PUSHJ P,OPNLUZ
PUSH P,NEWSIZ
PUSHJ P,OUTDIR
TRZ F,UPDIR+UPDTXT
POP P,NEWSIZ
MOVEI A,(I)
PUSHJ P,SETI
HRRZ B,@DIR
MOVE A,1(B)
TRNN F,WRITE
JRST WRPX4 ;FROM OUTDIR
HRRZ B,DIRP1
SUB A,1(B)
ASH A,7
PUSHJ P,COPDAT
HRRZ T,DIRP1
PUSHJ P,WRTIT
HLRZ A,I
PUSHJ P,SETI
HRRZ B,@DIRPT
MOVE A,1(B)
WRPX4: SUB A,DIREND+1
ASH A,7
PUSHJ P,COPDO
MOVEI D,EDFIL
PUSHJ P,OPNOI
JRST 4,.
TLZ F,ENTRD
MOVEI E,EDFIL
PUSHJ P,OPENW ;MAKE SURE RENAME HAPPENS
POPJ P,
;WRPOK, WRTIT, WRT0
WRPOK: TRNE F,XPAGE
JRST WRPX ;WANT TO BUBBLE ANYWAY
WRTIT: PUSH P,T
MOVEI E,EDFIL
PUSHJ P,OPENW
SKIPN DIRPAG
TRZ F,UPDIR
TRNE F,UPDIR
TRNE F,XPAGE
JRST WRT0
MOVE D,ODSIZ
CAIL D,200*5+3 ; ;-CR-LF
SKIPA D,[170700,,DRIV2+3]
MOVE D,[170700,,DRIV1+3]
MOVEM D,INPNT
MOVE C,PAGES
PUSHJ P,NUM5
MOVEI A,1
PUSHJ P,SETO
MOVE C,-3-1(D)
MOVEI D,
OUTPUT DSKO,C
WRT0: HRRZ A,DIRP1
MOVE A,1(A)
PUSH P,A
PUSHJ P,SETO
MOVEI A,PAGE
MOVEI DSP,WRDSP
MOVSI E,LSPC+NSPEC
MOVE G,OPNT
MOVN B,OCNT
MOVSI B,(B)
MOVE T,FIRPAG
SOJE T,WRLINE
;WRP1, WRLINE, WRLUP, WRLP2, WRRDO, WRRDO2, WRRDO3
WRP1: MOVEI C,14
IDPB C,G
AOBJN B,WRLINE
PUSHJ P,WRBUF
MOVE G,OPNT
MOVN B,OCNT
MOVSI B,(B)
WRLINE: HRRZ A,(A)
CAIN A,BOTSTR
JRST WRDONE
SKIPGE T,1(A)
JRST WRPM
MOVEI D,LLDESC(A)
TRNN T,777
TLOA D,350700
HRLI D,440700
HRRI B,
WRLUP: ILDB C,D
TDNE E,CTAB(C)
XCT @CTAB(C)
IDPB C,G
WRLP2: AOBJN B,WRLUP
PUSHJ P,WRBUF
MOVE G,OPNT
MOVN T,OCNT
HRLI B,(T)
JRST WRLUP
WRRDO:
IFN BOOKMD, {
SKIPE BOOKSW
JRST WRBOOK ;DONT EVER WRITE A BOOK
};END BOOKMD
SORRY PAGE HAS BEEN ALTERED -- PLEASE REAFFIRM MODE.
WRRDO2: MOVE E,[-NMCMDS,,MCMDS]
PUSHJ P,EXTEN1
JRST WRRDO3
PUSHJ P,(D)
TRNE F,REDNLY
JRST CLRWRT
JRST WRPAG1
WRRDO3: OUTSTR [ASCIZ /READONLY OR READWRITE.
/]
JRST WRRDO2
;WRDSP, WRTAB, WRCHK, WRDONE, WRDON2
WRDSP: JRST WRLINE
JRST 4,.
JFCL
MOVEI D, ;KILL NEXT ILDB
JRST WRTAB
JRST 4,.
JRST 4,.
WRTAB: IDPB C,G
HRROI C,-10
IORI C,(B)
SUB B,C
ADD D,BTAB2+10(C)
JUMPGE D,.+2
ADD D,[XOR 1]
SOJA B,WRLP2
WRCHK: LDB E,[370300,,G] ;SEE HOW MANY CHARS WE WROTE (FROM BLK -C(T))
ADD T,OBLK
LSH T,7
ADDI T,-OBUF+1(G)
IMULI T,5
SUB T,BTAB(E)
POPJ P,
WRDONE: POP P,T
SUB P,[1,,1]
MOVNI T,(T)
PUSHJ P,WRCHK
CAME T,CHARS
FATAL BUG IN WRITE CODE
MOVEM G,OPNT
PUSHJ P,CLOSO
MOVN T,NEWSIZ
TRNN F,XPAGE ;BEWARE OF SHRINKING BUBBLE
ADD T,OLDSIZ
JUMPLE T,WRDON2
MOVE A,[OBUF-1,,OBUF]
BLT A,OBUF+177
PUSHJ P,WRBUF
SOJG T,.-1
WRDON2: HRRZ T,@DIRPT
HRRZ T,1(T)
CAME T,OBLK
FATAL BUG IN WRITE CODE
TRNE F,UPDIR+UPDTXT
PUSHJ P,OUTDIR
JRST CLRWRT
;WRPM, BTAB2
WRPM: HRRZ B,-1(P)
MOVN T,1(B)
PUSHJ P,WRCHK
LDB C,[341000,,LLDESC+LPMTXT+1(A)]
IMULI C,200*5
LDB E,[221200,,LLDESC+LPMTXT+1(A)]
ADDI C,(E)
CAIE T,(C)
JRST 4,.
MOVEM G,OPNT
PUSHJ P,CLOSO
MOVE T,-1(P)
HRRZ T,(T)
MOVE C,OBLK
CAME C,1(T)
JRST 4,.
MOVEM T,-1(P)
MOVE G,OPNT
MOVN B,OCNT
MOVSI B,(B)
MOVSI E,LSPC+NSPEC
JRST WRP1
BTAB2: -340000,,1
-250000,,1
-160000,,1
-70000,,1
1
-340000,,
-250000,,
-160000,,
IMPURE
DEFINE INV!(X,Y){-L!X,,.
X: ASCII /COMMENT ⊗ INVALID XXXXX PAGES
Y
/
IFN <.-X>&1,<0> ;SUPER-WINNING CHANNEL
L!X←←.-X}
INV DRIV1,<⊗;>
INV DRIV2,THE REST OF THIS PAGE IS GARBAGE
PURE
;FLSPAG, FLSPGL, FLSPG2, CLRWRT, CLRWR2
FLSPAG: TRNE F,UPDIR
PUSHJ P,DIRFIX
TRNE F,REDNLY!EDDIR
SETZM ATTLOC
SKIPN C,LINES
JRST FLSPG2
HRRZ B,PAGE
TLO F,NOCHK
FLSPGL: MOVEI A,(B)
HRRZ B,(B)
PUSHJ P,FSGIVE
SOJG C,FLSPGL
FLSPG2: TLZ F,NOCHK
SETZM ARRLIN
SETZM WINLIN
SETZM XPAGES
SETZM XPLST
SETZM XCHRS
SETZM BOTSTR+1
CLRWRT: TRZN F,WRITE+UPDIR+UPDTXT+XPAGE
POPJ P,
CLRWR2: MOVEI T,1
MOVEM T,WFLAG
MOVEM T,WFLAG2
MOVE T,SCRTOP
HLLZS DPYTAB(T)
TRO F,DSPSCR
POPJ P,
;TV, RSYS, RUN, RUN1
FILWRD←←0 ;FOR PASSING RETURN FILNAM, ETC.
DEVWRD←←6 ;" (NOTE THIS STUFF IS SAME PLACE AS SYS PUTS IT)
TV: MOVE T,[440700,,[ASCIZ /TV/]]
MOVEM T,EXTPNT
RSYS: SKIPA T,['SYS ']
RUN: MOVSI T,'DSK'
MOVEM T,RUNFIL-1
MOVE T,EXTPNT
MOVEM T,TYIPNT
MOVE T,[MOVEI C,15]
MOVEM T,TYIINS
SETZM RUNFIL
MOVSI T,'DMP'
MOVEM T,RUNFIL+1
MOVE T,PPN
MOVEM T,RUNFIL+3
MOVE D,[SETZ RUNFIL]
PUSHJ P,FRD0
JRST RUNILL
TLNE D,40
JRST RUN1
SKIPN RPGACS+FILWRD
JRST RUNNON
SKIPE T,RPGACS+DEVWRD
MOVEM T,RUNFIL-1
MOVE T,[RPGACS+FILWRD,,RUNFIL]
BLT T,RUNFIL+1
MOVE T,RPGACS+FILWRD+3
TLNN T,77
JRST RUN1
TRNE T,77
MOVEM T,RUNFIL+3
RUN1: MOVE T,[RUNFIL-1,,LKUP-1]
MOVEI C,SWP
PUSHJ P,OPNDEV
LOOKUP SWP,LKUP
JRST RUNFNF
MOVE T,EDFIL
MOVEM T,RPGFIL
HLLZ T,EDFIL+1
TRNE F,REDNLY
TRO T,200000
SKIPN DIRPAG
TRO T,100000
MOVEM T,RPGEXT
MOVE T,EDFIL+3
CAMN T,PPN
MOVEI T,
MOVEM T,RPGPPN
PUSHJ P,GPAGL
HRRZM T,RPGPAG
HRR T,ATTNUM
IORI T,400000
TRNN F,ATTMOD
HRR T,EDCNM
MOVSM T,RPGLIN
TRZE F,ATTMOD
PUSHJ P,ATTEX
PUSHJ P,FINISH
MOVE T,[RUNFIL,,RPGACS+FILWRD]
BLT T,RPGACS+FILWRD+3
MOVE T,RUNFIL-1
MOVEM T,RPGACS+DEVWRD
MOVSI 17,RPGACS
BLT 17,17
MOVEI A,RUNDEV
SWAP A,
JRST 4,.
;RUNILL, RUNNON, RUNFNF, RUNDEV, RUNFIL
RUNILL: SORRY ILLEGAL FILE SPECIFICATION.
JRST POPJ1
RUNNON: SORRY I HAVEN'T ANYPLACE TO RETURN TO.
JRST POPJ1
RUNFNF: TLNN D,40
JRST RUNNON
PUSHJ P,FILERR
RELEAS SWP,
OUTSTR [ASCIZ /
/]
JRST POPJ1
IMPURE
RUNDEV: 0
RUNFIL: BLOCK 2
1
0
PURE
;SEARCH ROUTINES
;FLAGS
SDELIM←←1
SBKWDS←←2
SEXACT←←4
OFFPAG←←10
;DATA BLOCKS, E will contain FNDTBF (for 1 page) or FNDBUF (fon multipage)
SRCFLG←←0 ;Indexed by E to contain search string flag
SRCSIZ←←1 ; to contain search string size
SRCBUF←←2 ; to contain search string start
SUBFLG←←40 ;Indexed by E to contain substitution string flag
SUBSIZ←←41 ; to contain substitution string size
SUBTYP←←42 ; to contain type of associated search
SUBDEL←←43 ; to contain delete command string
;Cell reserved for deletion string overflow
SRFLG2←←45 ; To contain saved value of SRFLG for repeat
SUBBUF←←46 ; to contain substitution string start
;FREE STORAGE MACROS
DEFINE GETFS(X)
{ SKIPN X,@SFSPNT
PUSHJ P,SFSGT
EXCH X,SFSPNT}
DEFINE RETFS(X)
{ EXCH X,SFSPNT
HRRZM X,@SFSPNT}
SFSNUM←←8
;OPERATOR CODES
NOTOP←←2
INFOP←←3
OROP←←5
ANDOP←←6
BINOP←←7
ENDOP←←7
CROP←←10
CLOSOP←←11
ORCHR←←12
ANDCHR←←13
SGBBIT←←400000
SGEBIT←←200000
NLDBIT←←100000
NOTBT←←2000
XFRSAV←←4
INDTST←←5
REMTST←←10
LSBLK←←5
;SREAD, SREAD1, SREAD2, SREAD3, SREAD4, SRSTOR, SRSTR2
;Called by FINDIT (page 175) and FIND (page 176) to read string from TTY
;String is assembled in BUF and must be shorter than 199 characters
SREAD: HRRZM C,SAVEFX#
HRLM B,SAVEFX ;Save temporarily for later test and possible save
MOVEI T,
CAIN B,3
TRO T,SDELIM
JUMPGE A,.+2
TRO T,SBKWDS
TRZE F,EDITM
TRO T,EDITM
MOVEM T,SRFLG#
MOVMM A,SRCNT#
MOVE D,[440700,,BUF]
MOVNI B,SRSIZ*5-1
SETZM SRCSI2# ;To accumulate count of ¬ and ≡ symbols
TLZ F,TF1
PUSHJ P,TYI
JRST SREAD4 ;Find out the cause of activation
SREAD1: IDPB C,D
CAIN C,"≡"
SKIPE IDFLAG# ;So one can use ≡≡
JRST .+4
SETOM IDFLAG
AOS SRCSI2
SKIPA
SETZM IDFLAG
CAIN C,"¬"
AOS SRCSI2 ;The ¬ and ≡ symbols need special treatment
SREAD2: PUSHJ P,TYI
JRST SRACT ;Now act on extended string
SREAD3: AOJN B,SREAD1
SORRY SEARCH STRING TOO LONG.
SETZB D,SRCNT
AOS -1(P)
JRST SREAD2
;SREAD4 is called if an activation character is recieved before any characters.
;and it allows for ALT interruption. On a LF it returns to
;SREAD2 (with TF1 set in F) to allow for reading of additional TTY input.
;A "\" with bucky bits as the first character causes a transfer to QREADR which
;then permits a repetition of an old substitution request providing that
;SUBFLG(E) has not been reset to zero by the receipt of a new search command
;without an acceptable new substitution string. Any other activation character
;causes SREAD5 to be entered.
SREAD4: CAIN C,175
JRST POPTJ ;An ALT abort
LDB TT,[POINT 7,C,35]
CAIE TT,"∞"
CAIN TT,"\"
JRST QREADR ;This means repeat last substitution
CAIL TT,"0"
CAILE TT,"9"
SKIPA
JRST QREADR ;Argument for a repeat substitution
SETZM QCHR ;Definitely not a substitution
;put another saveguard in here
CAIE C,12
JRST SREAD5
TLO F,TF1
SOJA B,SREAD2
;SRSTOR stores the searched-for string away.
SRSTOR: JUMPLE D,SRSTR2
MOVEI TT,
IDPB TT,D
TLNE D,760000
JRST .-2
MOVSI TT,BUF
HRRI TT,SRCBUF(E)
SUBI D,BUF
ADDI D,(TT)
BLT TT,(D)
ADDI B,SRSIZ*5-1+1
MOVEM B,SRCSIZ(E)
SRSTR2: SETZM SUBTYP(E) ;Will be reloaded from SAVEFX for a substitution
SETZM SUBFLG(E) ;A new substitution string must be given
JUMPN D,.+2
MOVEI E,SRDUMY
SETZM QCHR ;This may also be a simple FIND so fix this also
JRST (Q)
;Entered from SRACT on the receipt of a \ as the first string termination
;QREAD sets up a 9-bit character string, an argument and delete command based on
;the size of the search string. This is stored at SUBDEL(E). Then the code accepts
;the substitution string and stores this temporarily in BUF. On the receipt of an
;activation character,the code then JRST's to QRACT, the string goes to SUBBUF(E),
;SAVEFX goes to SUBTYP(E), and QCHR and SUBFLG(E) ars set as requested
;by the activating character that terminates the substitution string.
QREAD: MOVEM A,QARG#
LDB B,[70200,,C]
MOVEM B,SUBTMP# ;Save bucky bits temporarily
MOVEI A,0
MOVEM A,SUBDEL(E) ;To guarentee termination
MOVEM A,SUBDEL+1(E) ;To guarentee termination
MOVE A,[POINT 9,SUBDEL(E)] ;We shift to 9-bit representation
MOVE D,[POINT 9,SUBDEL(E)]
MOVE T,SRCSIZ(E) ;Get size of searched-for string to set up deletes
SUB T,SRCSI2 ; The ¬ symbols do not count
HRLZM T,SUBSIZ(E) ;actual number to delete put in left half
SUBI T,1 ;Leave one delete until later for LINE-EDIT case
JUMPN T,QREADY ;There is more than 1 delete so get number less 1
MOVEI C,240 ;Just to be sure we enter LINE-EDITOR properly
IDPB C,D
MOVEI C,377
IDPB C,D ;Sure to be at first charaacter now
JRST QREADX
QREADY: PUSHJ P,NUMSTR
MOVEI C,0
IDPB C,A ;Temporary termination for number
;Now add CONTROL bits to this number
ILDB C,D
JUMPE C,.+4 ;Test for end of number
ADDI C,200 ;Add CONTROL bit
DPB C,D
JRST .-4
MOVEI C,304 ; Delete symbol replaces the temporary termination
DPB C,D
QREADX: MOVEI C,311 ;Readying the INSERT symbol
IDPB C,D
MOVEI C,0
IDPB C,D ;Now add final termination
IDPB C,D ;And an extra one for good measure
;Now read in the substitution string
QREAD0: MOVE D,[POINT 7,BUF] ;Go back to 7-bit for this
MOVNI B,SRSIZ*5-1 ;To count substitution characters
TLZ F,TF1
PUSHJ P,TYI
JRST QREAD4 ;Find out the cause of activation
QREAD1: IDPB C,D
QREAD2: PUSHJ P,TYI
JRST QRACT ;Now act on substitution string
QREAD3: AOJN B,QREAD1
outstr [asciz /
Substitution string is too long. Type termination character or <ALT> to abort.
/]
SETZB D,SRCNT
AOS -1(P)
JRST QREAD2
;Entered from QREAD if first character is an activator.
QREAD4: CAIN C,175
JRST POPTJ ;Still not to late to abort
OUTSTR [ASCIZ /
This is a VERY DANGEROUS command. ****
**** Do you really want a NULL substitution? (Type Y or N) /]
PUSHJ P,YESCHK
JRST .+4
CLRBFI
OUTSTR [ASCIZ /
Type corrected substitution string and proceed, or type <ALT> to abort.
/]
JRST QREAD0
OUTSTR [ASCIZ /
One Line-Editor-type substitution will be made as a trial.
/]
SUBI B,1 ;A false count has been made
MOVEI C,215
JRST QRACT2
;We only get here if there is a substitution string.
QRACT: CAIN C,175
JRST POPTJ ;Still not to late to abort
LDB TT,[POINT 7,C,35]
CAIN TT,"\"
MOVEI C,15
CAIN TT,15
JRST QRACT2
CAIE TT,"∞" ;Is it an ∞ command (with bucky bits)
JRST .+4
TRO F,ARG
MOVEI A,144
JRST QRACT4
MOVEI A,0
TRZ F,ARG
QRACT0: LDB TT,[POINT 7,C,35]
CAIL TT,"0"
CAILE TT,"9"
JRST QRACT1
TRO F,ARG
IMULI A,12
ANDI TT,17
ADD A,TT
QRACT4: PUSHJ P,TYI
JRST QRACT0
JRST QRACT0
QRACT1: TRZN F,ARG
JRST QRACT2
CAILE A,144
MOVEI A,144 ;Limit to 100 before requesting confirmation
MOVNS A
HRLZS A
JRST QRACT3
QRACT2: MOVE A,[-2,,-1] ;The correct value for QCHR if not ∞ or <CONT><CR>
CAIN C,215 ;Is command a CONTROL><CR> ?
MOVEI A,1 ;This forces a LINE-EDIT type substitution
QRACT3: CLRBFI ;This does not seem to be necessary but may be safer
MOVEM E,SAVEE# ;It is now time to reset SAVEE
MOVEM A,QCHR ;Set priming word for proper code entry
MOVEM A,SUBFLG(E) ;Arm the substitution buffer space
TRZ F,ARG!REL ;Not wanted if a substitution
MOVEI TT,
IDPB TT,D ;Terminate the string
TLNE D,760000 ;Pad out with nulls
JRST .-2
MOVSI TT,BUF
HRRI TT,SUBBUF(E)
SUBI D,BUF
ADDI D,(TT)
BLT TT,(D) ;Store string away in SUBBUF(E)
ADDI B,SRSIZ*5-1+1 ;To get insertion count
HRRM B,SUBSIZ(E) ;Must not bother deletion count in left half
MOVE TT,SAVEFX
MOVEM TT,SUBTYP(E) ;Validate type of search
JRST SREAD6
;This code is entered from SREAD4 when a \, ∞, or a # (with activation bits) is the
;first character showing that no new string is to be typed. This is NOT ACCEPTABLE.
QREADR: OUTSTR [ASCIZ /
Not an acceptable command without a searched-for string.
/]
JRST POPTJ
QREADN: OUTSTR [ASCIZ /
No proper substitution string or an improper request.
Substitution aborted. You must now retype entire command.
/]
SETZM QCHR ;Better be safe
TLZ F,OKF
JRST POPTJ
;SRACT, SREAD5, SRALT, SRALT2, SRALUZ, SREDT
SRACT: TLNE F,TF1
JRST SRALT
JSP Q,SRSTOR
SREAD5: LDB TT,[POINT 7,C,35]
CAIN TT,"\"
JRST QREAD
SETZM QCHR ;Safety measure to inhibit substitution
SREAD6: TRZ F,ARG!REL!NEG
MOVEI DSP,CMDSP
MOVEI A,
PUSH P,E
PUSHJ P,CMDEX
JRST [SUB P,[2,,2]↔JRST POPJ2]
POP P,E
MOVE T,SRFLG
MOVEM D,SDSP#
MOVEM A,SARG#
HRLI C,(B)
MOVEM C,SCHR#
TLNE D,SACMD
JRST .+3
TLNE D,SSCMD
XCT -1(D)
MOVEM T,SRFLG ;This seems to get clobbered during search
MOVEM T,SRFLG2(E) ;Save separately to replace for repeat
TRNN T,EDITM
POPJ P,
MOVE A,ARRLIN
HRRZ T,2(A)
MOVEM T,SRCNUM
MOVE T,EDCNM
MOVEM T,SRCOFF
POPJ P,
SRALT: CAIN C,15
JRST SREAD3
CAIN C,175
JRST POPTJ
CAIE C,12
JRST SRALUZ
JSP Q,SRSTOR
SRALT2: PUSHJ P,TYI
JRST SREAD5
JRST SRALT2
SRALUZ: MOVEM C,COMCHR
JRST POPTJ
;This code responds to the \ command.
;<CONTROL>\ accepts the last substitution (if still unconfirmed) and goes
;on to show the next one using the slow LINE-EDIT mode which permits one to
;cancel the substitution by an ALT.
;<META>\ not a proper command in this context. It introduces a \ in the text.
;<META><CONTROL>\ accepts the last unconfirmed substitution and proceeds to make
;a fast substitution. This command will accept an argument and will then make the
;requested number of substitutions if there are that many available. The ∞ sign is
;taken to mean 100.
;It should be noted that only one type of substitution (F or XF) is remembered
;although one can interpose an ordinary FIND command of the opposite type without
;obliterating the record of the remembered substitution (with entry via SAVEE).
BSLAS: MOVE E,SAVEE
SKIPE SUBTYP(E) ;Are we primed for a repeat?
SKIPN SUBFLG(E) ;Still checking
JRST BLAS1 ;Alas, no
CAIG B,3 ;Did we come from within a line?
JRST .+6 ;No
LDB B,[70200,,EDCHR] ;Yes
MOVE TT,SRFLG2(E)
TRO TT,EDITM
MOVEM TT,SRFLG2(E)
TRZ F,EDITM
MOVE TT,SRFLG2(E)
MOVEM TT,SRFLG
CAIE B,1
MOVEI B,0
MOVEI C,15
TRZ F,ARG!REL!NEG
BLASX: CAIE B,0
CAILE A,1
JRST BLAS0
MOVEI A,1
MOVE D,[400,,EDIT] ;Left here for test purposes only
MOVE D,[102000,,CONTCR]
JRST BLAS3
BLAS0: MOVEI B,0
CAIG A,1
JRST BLAS2
CAILE A,144
MOVEI A,144
MOVNS A
HRLZS A
SKIPA
BLAS2: MOVE A,[-2,,-1]
MOVE D,[MOVSM REGCR]
BLAS3: MOVEM A,QCHR
MOVEM A,SUBFLG(E)
MOVEI A,1
MOVE T,SRFLG
MOVEM D,SDSP
MOVEM A,SARG
HRLI C,(B)
MOVEM C,SCHR
TLNE D,SACMD
JRST .+3
TLNE D,SSCMD
XCT -1(D)
MOVEM T,SRFLG
TRNN T,EDITM
JRST BLAS4
MOVE A,ARRLIN
HRRZ T,2(A)
MOVEM T,SRCNUM
MOVE T,EDCNM
MOVEM T,SRCOFF
BLAS4: MOVEI A,1
MOVE D,SDSP
CAIN E,FNDBUF
JRST FINBSL ;Go to the X routine
CAIN E,FNDTBF
JRST FNDBSL ;Go to the page-only routine
BLAS1: OUTSTR [ASCIZ /
Repeat command not properly primed so retype from start.
/]
SETZM QCHR
SETZM SUBFLG(E)
SETZM SUBTYP(E)
AOS (P)
POPJ P,
;This is the code that actually does the substitution in EDGL if QCHR
;is positive. It must also be armed by having a positive value in SUBFLG(E).
BSLXCT: MOVE E,SAVEE
SKIPLE SUBFLG(E) ;This must be ≥0 for a legal substitution
JRST BSLXC2
OUTSTR [ASCIZ /
WOOPS! the system goofed! but it is all right, ETV was on the job.
/]
SETZM QCHR ;Disarm
POPJ P, ;and forget it.
BSLXC2: MOVEI T,0
MOVEI TT,SUBDEL(E)
HRL TT,[441100]
PTWRS9 T ;Send delete string to PTY
MOVEI TT,SUBBUF(E)
HRL TT,[440700] ;Back to 7-bit for substitution string
PTWRS7 T ;Send substitution string to PTY
MOVEI TT,304 ;Now a final delete to wipe out remaining character
PTWR1W T
MOVEI TT,377 ;and then a BACK-SPACE so single character will work
PTWR1W T
BSLXC3: PUSHJ P,SUBSAY ;To type message and return
OUTSTR [ASCIZ /Line is in the LINE-EDITOR. Type <ALT> to abort, or edit and exit as usual.
/]
SETZM QCHR ;We do not want to go around again
POPJ P,
;FINDIT, FOUND, FNDMOV, FNDERR
;FINDIT is called by the F command (single page search)
FINDIT: SETZM TYIPNT
MOVEI E,FNDTBF
PUSHJ P,SREAD ;To read string in from TTY (on page 173)
FNDBSL: MOVE TT,SRFLG2(E)
MOVEM TT,SRFLG
PUSHJ P,SCOMP
FNDBS2: PUSHJ P,SRCPAG
JRST FNDERR
FOUND:
PUSHJ P,SPFIN
PUSHJ P,SFLUSH
FND2: HLRZ B,SCHR
HRRZ C,SCHR
MOVE A,SARG
MOVE D,SDSP
TRNE F,ARG
TRNE F,REL
TLNN D,SACMD
JRST FNDMOV
TRON F,ARG!REL
MOVEI A,
TLNE D,SSCMD
XCT -1(D)
SUB A,ARRL
ADD A,SRCL
SKIPN QCHR
JRST POPJ2 ;Normal FIND exit
MOVEM A,LSTARG
MOVEM D,LSTCOM
MOVE B,ARRL
FND3: PUSHJ P,MOVARR
JRST SUBSTR
POPJ P,
FNDMOV:
JUMPGE D,.+2
TRNN F,REL
SKIPA A,SRCL
ADD A,SRCL
PUSHJ P,SETARR
MOVE A,SARG
MOVSI T,1 ;To insure entry into LINE EDITOR
IORM T,SRCOFF ;Only right half is used to count
HRRZ T,SRCOFF
TLNE D,EDOK*10
MOVEM T,EDMOV
SETZM ESCIEN
JRST POPJ2 ;This will leave us in the LINE-EDITOR
FNDERR: SKIPE ESCIEN ;DIRECT IF ESC I GOT US HERE
JRST FNDER3
SKIPE QCHR
JRST SUBERR
MOVE T,SRCN1
CAME T,SRCNT
SKIPA T,[[ASCIZ /NOT FOUND ENOUGH -- /]]
MOVEI T,[ASCIZ /NOT FOUND -- /]
FNDER2: OUTSTR [ASCIZ /
SORRY -- /]
OUTSTR (T)
CAIA
FNDER3: OUTSTR [ASCIZ / while searching for /]
SETZM ESCIEN
MOVE B,SDATA
ADDI B,SRCBUF
PUSHJ P,SFLUSH
SETZM COMCHR
JRST CMDER2
;This message appears at end of a repeating substitution execution.
SUBERR: MOVE B,SDATA
ADDI B,SRCBUF
PUSHJ P,SFLUSH
SUBSTP: SETZM QCHR
SETZM TYOPNT
MOVE E,SAVEE
MOVE T,SUBFLG(E)
HRRZ TT,T
CAIE T,1
CAMN T,[-2,,-1]
SKIPA
JUMPG TT,.+3
OUTSTR [ASCIZ/
Not found, trying to replace \/]
JRST .+4
OUTSTR [ASCIZ /
After /]
TYPDEC TT
OUTSTR [ASCIZ / replacements of \/]
MOVEI T,0
MOVE A,[POINT 7,SRCBUF(E)]
ILDB TT,A
JUMPE TT,.+3
OUTCHR TT
JRST .-3
OUTSTR [ASCIZ /\ with \/]
MOVE A,[POINT 7,SUBBUF(E)]
ILDB TT,A
JUMPE TT,.+3
OUTCHR TT
JRST .-3
OUTSTR [ASCIZ /\.
/]
SETZM ESCIENS
JFCL
PUSHJ P,DISP ;Now we want it displayed
TLZ F,OKF
AOS (P)
POPJ P,
;FIND
FIND:
SETZM ESCIEN ;THE ONLY COMMENT IN THE SEARCH CODE
MOVE T,EXTPNT
MOVEM T,TYIPNT
HRLI C,(<MOVEI C,>)
MOVEM C,TYIINS
MOVEI E,FNDBUF
PUSHJ P,SREAD
FINBSL: MOVE TT,SRFLG2(E)
MOVEM TT, SRFLG
SETZM TYIPNT
PUSHJ P,SCOMP
FINBS2: TRNE F,SBKWDS
SKIPA T,[SCONTB]
MOVEI T,SCONTF
PUSHJ P,SRCPG1
JRST FNDERR
TRZN G,OFFPAG
JRST FOUND
EXCH G
MOVEI D,-SBKDSP(G)
IDIVI D,3
HLLZ D,BTAB3(D)
HRRI D,@SBKNWA
MOVEM D,SCLOB#
MOVE D,IBLK
MOVE T,SDIRPT
SUBI D,@1(T)
MOVEM D,TSTBLK
PUSHJ P,SFLUSH
PUSHJ P,WRPAGE
PUSHJ P,FLSPAG
MOVE A,SRCPG
PUSHJ P,FNDPAG
HRRZ T,1(T)
ADDM T,TSTBLK
MOVEI T,SSET
MOVEM T,TSTSET
PUSHJ P,NEWPG1
SKIPA B,[400]
JSP SARRGH
PUSHJ P,FSGET
HRRM A,SCXCT
MOVEI T,-1(T)
MOVEM T,SFSLST
MOVEM F,SSAVF
EXCH F,SRFLG
MOVE D,[SRCPGB,,SRCPGF]
MOVEM D,SRCTYP
MOVEI T,SBKNL
HRRM T,SBKNW
MOVE A,SRCL
PUSHJ P,FNDLIN
MOVE A,SRCLIN
MOVEM T,SRCLIN
ADDI A,(T)
MOVEI E,
PUSHJ P,SCNBAK
PUSHJ P,SPFIN
EXCH F,SRFLG
HRRZ A,SCXCT
PUSHJ P,FSGIVE
MOVN A,GTDEL
ASH A,-1
ADD A,SRCL
PUSHJ P,SETWIN
JRST FND2
;DIRSRC, DFERR, SRCDF, SDFCR
DIRSRC: SUB P,[1,,1]
SETZM TYIPNT
TRZ T,SBKWDS
MOVEM T,SRFLG
MOVEI D,CPOPJ
MOVEM D,SDSP
PUSHJ P,SCOMP
MOVEI D,SRCDF
PUSHJ P,SRCSET
MOVEI T,1
MOVEM T,SRCPG
HRRZ A,DIR
MOVEM A,SRCLIN
ADD A,[440700,,LPDESC]
ILDB C,A
MOVEI D,3
PUSHJ P,SCALL
JRST DFERR
MOVE A,SRCPG
EXCH F,SRFLG
CAMN A,FIRPAG
JRST [MOVEI A,1↔PUSHJ P,SETARR↔JRST .+2]
PUSHJ P,NEWPG0
SKIPA B,SCHR
JSP SARRGH
TLNN B,2
JRST SFLSH1
EXCH F,SRFLG
MOVEI T,2
MOVEM T,SRCN1
SETZM SRCOFF
PUSHJ P,SRCPAG
SOSG SRCN1
JRST FOUND
SKIPA T,[[ASCIZ /FOUND IN DIRECTORY ONLY (HUH?) -- /]]
DFERR: MOVEI T,[ASCIZ /NOT IN DIRECTORY -- /]
JRST FNDER2
SRCDF: 15↔JSP SDFCR
0↔JSP SARRGH
177↔JSP SARRGH
SDFCR: HRRZ A,@SRCLIN
CAIN A,DIREND
JRST SRCHLX
MOVEM A,SRCLIN
AOS SRCPG
ADD A,[350700,,LPDESC]
LDB C,A
JRST @
;SSET, SSET2
SSET: SETZM TSTBLK
LDB C,SCLOB
MOVEM C,SRCOFF
MOVEI C,177
DPB C,SCLOB
MOVEI C,SSET2
MOVEM C,RLDA
POPJ P,
SSET2: MOVE C,LINES
ADDI C,1
MOVEM C,SRCL
MOVE C,E
IBP C
SUBI C,(A)
MOVEM C,SRCLIN
MOVEI C,RLD
MOVEM C,RLDA
POP P,C
HRLI C,SRCOFF
JRA C,-2(C)
SCONTB: JSP SBARF
;SCOMP, SCOMPX, SCOMPR
;Called by FINDIT (page 175), FIND (page 176) and DIRSRC (page177)
SCOMP: MOVEM P,SSAVP#
MOVEM F,SSAVF#
MOVEM E,SDATA#
MOVEI T,[0]
MOVEM T,SFSPNT#
SETZM SFSLST#
HLLZS VBBITS
MOVE B,SRCSIZ(E)
ADDI B,1
MOVE T,SRFLG
TRNE T,SDELIM
ADDI B,2
LSH B,1
EXCH F,SRFLG
IOR F,SRCFLG(E)
PUSHJ P,SFSGET
JSP TT,SFSPUT
TRNE F,SEXACT
TDZA TT,TT
SKIPA TT,[377777777000]
TDZA T,T
MOVSI T,LETF
MOVEM T,SLMODE#
MOVEM TT,SLMOD2#
SKIPE A,SRCNT
PUSHJ P,SPARSE
JUMPE A,NOSRCH
PUSHJ P,SGRAPH
PUSHJ P,SBACK
JRST SCGEN
SFLUSH: EXCH F,SRFLG
SFLSH1: SETZM SFSPNT
TLO F,NOCHK
SKIPA A,SFSLST
SFLSL: MOVEI A,(C)
HLRZ C,(A)
HRRZ T,(A)
SUBI A,-2(T)
PUSHJ P,FSGIVE
JUMPN C,SFLSL
TLZ F,NOCHK
MOVE T,[PUSHJ P,UUOH]
MOVEM T,41
POPJ P,
NOSRCH: OUTSTR [ASCIZ /NULL SEARCH NOT EXECUTED
/]
JRST SBARF2
;SBARF, SBARF1, SARRGH, SFSGT, SFSGET, SFSPUT, SFSPTL
SBARFI: OUTSTR [ASCIZ /SEARCH TERMINATED BY <ESC>I
/] ↔ CAIA
SBARF: OUTSTR [ASCIZ /SEARCH STRING TOO COMPLEX.
/]
SUBI 1
SBARF1: MOVEM SBADR#
SBARF2: MOVE F,SSAVF
MOVE P,SSAVP
SUB P,[1,,1]
SKIPN T,FSEND1
JRST .+3
MOVEM T,FSEND
PUSHJ P,ENDFIX
PUSHJ P,SFLSH1
JRST POPJ1
SARRGH: OUTSTR [ASCIZ /INTERNAL SEARCH LOSSAGE.
/]
SOJA SBARF1
SFSGT: FOR X IN(A,B,T,TT){PUSH P,X↔}
MOVNI T,2
ADDM T,-4(P)
CAML P,[-10,,PDL-1+LPDL-10]
JSP SBARF
MOVEI B,SFSNUM*2
PUSHJ P,SFSGET
JSP TT,SFSPUT
FOR X IN(TT,T,B,A){POP P,X↔}
POPJ P,
SFSGET: EXCH F,SRFLG
PUSHJ P,FSGET
EXCH F,SRFLG
HRLI T,LOKBIT
HLLM T,-1(A)
MOVEI T,-1(T)
EXCH T,SFSLST
HRLM T,@SFSLST
POPJ P,
SFSPUT: LSH B,-1
SKIPA T,A
SFSPTL: HRRZM T,-2(T)
ADDI T,2
SOJG B,SFSPTL
EXCH A,SFSPNT
HRRZM A,-2(T)
JRST (TT)
;SPARSE
SPARSE: MOVSI A,440700
HRRI A,SRCBUF(E)
MOVSI H,NSPEC!SSP1
SETZM SLEV#
TRNE F,SBKWDS
SKIPA T,[HRRM B,(G)]
SKIPA T,[HLRM G,(B)]
SKIPA TT,[MOVS G,G]
MOVSI TT,(<JFCL>)
MOVEM T,SSLINK#
MOVEM TT,SSSWAP#
MOVEI DSP,SSCDSP
MOVEI Q,ENDOP
PUSHJ P,SPARS1
CAIN Q,ENDOP
SKIPE SLEV
JRST 4,.
MOVEI A,(G)
TRNN F,SDELIM
POPJ P,
JUMPE A,CPOPJ
GETFS T
MOVE A,[1,,VBBITS]
HLLZM A,(T)
HRRZM A,1(T)
HLRZ TT,G
HRRM T,(TT)
GETFS T
HRRZM A,1(T)
HLRE TT,(G)
JUMPL TT,.+2
ADDI TT,200
ANDI TT,¬77
HRLI G,1(TT)
MOVEM G,(T)
MOVEI A,(T)
POPJ P,
;SPARS1, SPARS2, SPDSP, SSCAN, SSCANA, SSCANX
SPARS1: HRLM Q,(P)
PUSHJ P,SSCAN
SPARS2: HLRZ D,(P)
CAIG Q,(D)
POPJ P,
PUSH P,G
PUSHJ P,SPARS1
POP P,T
HRLI T,(G)
GETFS G
HRLI G,(G)
MOVSM T,1(G)
HLRZ T,(T)
LSH T,-6
CAIE T,(E)
SETOB T,E
LSH T,6
XCT SPDSP-BINOP(D)
HRLZM T,(G)
JRST SPARS2
SPDSP: JRST 4,.
IORI T,OROP
JRST 4,.
IORI T,OROP
IORI T,ANDOP
SSCAN: SETZB E,G
PUSHJ P,SSCAN1
CAIL Q,BINOP
POPJ P,
JUMPE G,.-3
MOVS B,G
SSCANA: ANDI T,¬77
ADDI E,(T)
PUSHJ P,SSCAN1
CAIL Q,BINOP
JRST SSCANX
JUMPE G,.-3
XCT SSLINK
HRRI B,(G)
JRST SSCANA
SSCANX: HLR G,B
XCT SSSWAP
LSH E,-6
DPB E,[301400,,(G)]
JUMPGE T,CPOPJ
IORM T,(G)
POPJ P,
;SSCAN1, SSCN1A, SSCN1B, SSCQT, SSCBIN, SSCINF, SSCNOT, SSCUOP, SSCVB
SSCAN1: ILDB C,A
TDNE H,CTAB(C)
XCT @CTAB(C)
SSCN1A: MOVEI Q,
SSCN1B: MOVEI T,100
GETFS G
HRLI G,(G)
HRLZM Q,(G)
MOVEM C,1(G)
POPJ P,
SSCQT: ILDB C,A
JUMPN C,SSCN1A
SSCBIN: LDB Q,[270400,,@CTAB(C)]
POPJ P,
SSCINF: MOVEI Q,INFOP+400000
MOVSI T,-100
ILDB C,A
CAIN C,"∞"
AOJA Q,SSCUOP
JRST 2,@[20000,,SSCUOP]
SSCNOT: MOVEI Q,NOTOP
SSCUOP: HRLM Q,(P)
PUSHJ P,SSCAN1
CAIL Q,BINOP
POPJ P,
ANDI T,¬77
TSO T,(G)
HRLM T,(G)
HLRE Q,(P)
JUMPGE Q,.+4
ANDI Q,77
JUMPE G,.+2
MOVEI T,-100
MOVEI TT,(G)
GETFS G
HRLI G,(G)
MOVEM TT,1(G)
ANDI T,¬77
IORI T,(Q)
HRLZM T,(G)
POPJ P,
SSCVB: MOVEI C,VBBITS
MOVEI Q,1
JRST SSCN1B
;SSCLP, SSCDSP
SSCLP: AOS SLEV
MOVSI H,NSPEC!SSP1!SSP2
MOVEI Q,CLOSOP
HRLM E,(P)
PUSH P,B
PUSHJ P,SPARS1
POP P,B
HLRE E,(P)
SOSG SLEV
MOVSI H,NSPEC!SSP1
CAIE Q,CLOSOP
ADD A,[70000,,]
SKIPN Q,G
TDZA T,T
LDB Q,[220600,,(G)]
XCT SSSWAP
POPJ P,
SSCDSP: JUMPA ENDOP,SSCBIN
JRST 4,.
JUMPA CROP,SSCBIN
JRST 4,.
JRST 4,.
JRST SSCAN1
REPEAT 12-6,{JRST 4,.}
JUMPA ANDCHR,SSCBIN
JRST SSCNOT
JRST SSCLP
JUMPA CLOSOP,SSCBIN
MOVSI C,NOTBT
JRST SSCQT
JUMPA ORCHR,SSCBIN
JRST SSCINF
JRST SSCVB
FACNT←←174
FABITS: FACNT,,
377537,,-20
-20
-20
-40
;SGRAPH, SGRPH1, SGRPH2, SGRPHX, SGDO1, SGDO1X, SGDOX2, SGDSP, SGDO1B
SGRAPH: SETZM SSVNUM#
SETZM SSVMAX#
PUSHJ P,SGDO1
JUMPE B,CPOPJ
HRLM B,(P)
SGRPH1: HLRZ C,B
PUSHJ P,SGDO1
JUMPE B,SGRPHX
SGRPH2: MOVSI T,SGEBIT
ANDCAM T,1(C)
HRRZ TT,(C)
HRRM B,(C)
HRLM C,(B)
JUMPE TT,SGRPH1
MOVEI C,(TT)
; PUSHJ P,SGDUP
JRST SGRPH2
SGRPHX: MOVSI B,(C)
HLR B,(P)
POPJ P,
SGDO1: SKIPN B,A
POPJ P,
HRRZ A,(A)
LDB T,[220600,,(B)]
XCT SGDSP(T)
SGDO1X: IORB T,1(B)
SGDOX2: LDB TT,[301400,,(B)]
SETZM (B)
HRLI B,(B)
TLNN T,NOTBT
POPJ P,
AOS T,SSVNUM
CAMLE T,SSVMAX
MOVEM T,SSVMAX
DPB T,[221100,,1(B)]
POPJ P,
SGDSP: MOVSI T,SGEBIT
JRST SGDO1B
JRST SGNOT
REPEAT 4,{JSP SBARF}
SGDO1B: AOS T,SSVNUM
CAMLE T,SSVMAX
MOVEM T,SSVMAX
MOVSI T,SGEBIT!1000(T)
JRST SGDO1X
;SGNOT
SGNOT: HRLM A,(P)
HRRZ A,1(B)
RETFS B
PUSHJ P,SGDO1
HLRZ A,(P)
JUMPE B,CPOPJ
CAIE TT,1
JSP SBARF
MOVSI T,NOTBT
XORB T,1(B)
TLNE T,NOTBT
JRST SGDOX2
HLRZ T,T
ANDI T,777
CAMN T,SSVMAX
SOS SSVMAX
SOS SSVNUM
MOVSI T,777
ANDCAM T,1(B)
JRST SGDOX2
;SBACK, SBACK1, SBACK2, SBACK3, SBACK4
SBACK: HRRZM B,SGPNT#
HLRZ A,B
MOVEI C,SGEND#
MOVSI T,INDTST⊗9
HLLOM T,SBLST+1
SETZM SGECNT#
SBACK1: GETFS T
HRRZM T,(C)
AOS SGECNT
MOVEI C,(T)
MOVEI B,(A)
SKIPL 1(B)
JRST .+4
HLRZ B,(B)
HRRZ T,1(B)
JUMPN T,.-2
HRLI A,(B)
MOVEM A,(C)
SETZM 1(C)
HRL C,(A)
PUSH P,C
PUSHJ P,SBCALC
PUSHJ P,[TLZN B,NLDBIT↔HLRZ B,(B)↔HLRZ G,(C)↔POPJ P,]
JRST 4,.
SKIPGE 1(B)
HRRZ B,(B)
HLRZ A,(C)
HRRZM A,1(C)
HRRM B,(A)
IORM B,(A)
HRRZ C,(C)
SBACK2: PUSHJ P,SBCALC
MOVEI G,(C)
JRST SBACK4
HLRZ T,(C)
SKIPGE 1(C)
JRST SBBRCH
SBACK3: SKIPGE 1(B)
HRR B,(B)
HRLM B,(C)
ANDCMI B,-1
IORM B,1(C)
SKIPE C,T
JRST SBACK2
SBACK4: POP P,C
HLRZ A,C
JUMPN A,SBACK1
SETZM (C)
POPJ P,
;SBBRCH, SBBR2
SBBRCH: SKIPN A,T
TROA A,SGPNT
SKIPL 1(A)
JRST SBBR2
SKIPA A,(A)
HLRZ A,(A)
HRRZ TT,(A)
CAIE TT,(C)
JRST .-3
SBBR2: HRRZ TT,(C)
HRRM TT,(A)
MOVEI A,(C)
HRRZ C,1(C)
RETFS A
JRST SBACK3
;SBCALC, SBCAL0, SBCAL1, SBCAL2, SBCAL3
SBCALC: SETZM SBLST
SKIPGE T,1(C)
JRST SBCBP
TLC T,NOTBT
SBCAL0: MOVEM T,SBTST#
HLRZ B,(C)
MOVSI D,(C)
HRRI D,SBLST1
SETZM SBLST1#
JUMPE B,SBCNON
HLRZ A,(B)
MOVEI B,(C)
TLZ F,TF1
SBCAL1: JUMPE A,SBCAL3
HLRZ G,(C)
MOVEI H,(A)
SBCAL2: JSP E,SCCOM
JRST SBCLUZ
JRST SBCCB
JRST SBCCB
SKIPA T,1(H)
SBCL2A: MOVE T,1(H)
TLNE T,777
TLO F,TF1
HLRZ G,(G)
HLRZ H,(H)
JUMPN H,SBCAL2
SBCAL3: MOVEI G,SBTST-1
HLRZ H,(B)
JSP E,SCCOM
JRST SBCLUZ
JRST SBCAL4
JRST SBCAL4
SKIPA T,1(H)
MOVE T,1(H)
TLNN T,777
JRST SBCX
;FALLS THRU TO SBCAL4
;SBCAL4, SBCNON, SBCX, SBCOPL, SBCOP2, SBCEND, SBCEN2, SBCFIX, SBCFXL, SBCFXE, POPJ2
SBCAL4: MOVEI B,(H)
TLOA B,NLDBIT
SBCNON: HRRZ B,SGPNT
SBCX: XCT @(P)
TLZN F,TF1
JRST SBCEND
HLRZ H,(B)
JUMPE H,SBCEND
TLNE B,NLDBIT
HLRZ G,(G)
SBCOPL: MOVE T,1(H)
TLNN T,777
JRST SBCOP2
TLZ T,¬777
TLO T,XFRSAV⊗9
IOR T,B
HRRI T,(G)
GETFS TT
HRRZM B,(TT)
MOVEM T,1(TT)
MOVEI B,(TT)
SBCOP2: HLRZ G,(G)
HLRZ H,(H)
JUMPN H,SBCOPL
SBCEND: SKIPN SBLST1
JRST SBCOK
TLNE B,NLDBIT
JRST SBCEN1
HRRM B,(D)
SBCEN2: MOVE B,SBLST1
SKIPN T,SBLST
MOVEI T,SBLST
SBCFIX: HLLZ TT,B
SBCFXL: LDB G,[3700,,1(T)]
CAML G,[INDTST⊗9,,]
TRNN G,-1
JRST SBCFXE
HRLM B,(T)
IORM TT,1(T)
HRRZ T,(T)
JUMPN T,SBCFXL
SBCFXE: HRRM B,SBLST
HLRZ B,D
SKIPE SBLST1
JRST SBCNXT
HLRZ B,SBLST
POPJ2: POP P,T
JRST 2(T)
;SBCOK, SBCEN1, SBCLUZ, SBCLZ1, SBCNXT, SBCBP, SBCBPL
SBCOK: SKIPN T,SBLST
JRST POPJ2
JRST SBCFIX
SBCEN1: GETFS T
HRLZM B,(T)
MOVSI B,INDTST⊗9!NLDBIT
MOVEM B,1(T)
HRRM T,(D)
JRST SBCEN2
SBCLUZ: SKIPN T,SBLST1
JRST SBCNXT
SBCLZ1: HRRZ TT,(T)
RETFS T
SKIPE T,TT
JRST SBCLZ1
SBCNXT: HLRZ B,(B)
MOVSI D,(B)
HRRI D,SBLST1
SETZM SBLST1
JUMPE B,SBCNON
HLRZ A,(B)
JUMPE A,SBCNON
HLRZ A,(A)
JRST SBCAL1
SBCBP: MOVSI T,-1
ADDB T,1(C)
TLNE T,777
JRST POPJ1
MOVE A,[FABITS+1,,SBBUF]
BLT A,SBBUF+3
SKIPA G,(C)
SBCBPL: MOVEI G,(T)
PUSHJ P,MAKBIT
ANDCAM TT,SBBUF(T)
HLRZ T,(G)
CAIE T,(C)
JRST SBCBPL
HRRM G,1(C)
MOVSI T,SGBBIT
ANDCAM T,1(G)
MOVE T,[1000,,SBBUF-1]
JRST SBCAL0
;SBCCB, SBCCB1, SBCCB2, SBCCB8, SBCCB3, SBCCB4, SBCCB5
SBCCB: EXCH G,H
PUSHJ P,MAKBIT
MOVEM TT,BITBF1(T)
EXCH G,H
PUSHJ P,MAKBIT
ANDM TT,BITBF1(T)
SKIPN T,SBLST
JRST SBCCB3
LDB E,[221100,,1(G)]
JUMPN E,.+2
JSP SARRGH
PUSH P,G
HLRZ T,T
SBCCB1: LDB TT,[330400,,1(T)]
CAIGE TT,INDTST
JRST SBCCB8
MOVEI G,(T)
SBCCB2: LDB T,[221100,,1(G)]
CAIE T,(E)
JRST .+3
PUSHJ P,MAKBIT
ANDCAM TT,BITBF1(T)
HRRZ T,(G)
JUMPN T,SBCCB1
SBCCB8: HLRZ G,(G)
JUMPN G,SBCCB2
POP P,G
SBCCB3: MOVEI E,BITBF1-1
PUSHJ P,BITCNT
JUMPE T,SBCLUZ
CAIN T,1
JRST SBCCB7
CAIN T,2
JRST SBCCB6
SBCCB4: MOVSI E,INDTST⊗9
HRRI E,(H)
SBCCB5: GETFS T
HRRM T,(D)
HRRI D,(T)
SETZM (D)
LDB T,[221100,,1(G)]
TLO E,(T)
MOVEM E,1(D)
JRST SBCL2A
;SBCCB6, SBCCB7, BITCNT, BITCN1
SBCCB6: SKIPE TT,3(E)
CAME TT,4(E)
JRST SBCCB4
TDNN TT,SLMOD2
JRST SBCCB4
SBCCB7: PUSHJ P,NEWBTC
TLO E,REMTST⊗9
JRST SBCCB5
BITCNT: SKIPE T,1(E)
PUSHJ P,BITCN1
PUSH P,T
SKIPE T,2(E)
PUSHJ P,BITCN1
ADD T,(P)
IDIVI T,77
MOVEM TT,(P)
SKIPE T,3(E)
PUSHJ P,BITCN1
PUSH P,T
SKIPE T,4(E)
PUSHJ P,BITCN1
POP P,TT
ADD T,TT
IDIVI T,77
POP P,T
ADD T,TT
POPJ P,
BITCN1: MOVE TT,T
LSH TT,-1
AND TT,[333333333333]
SUB T,TT
LSH TT,-1
AND TT,[333333333333]
SUBB T,TT
LSH TT,-3
ADD T,TT
AND T,[70707070707]
POPJ P,
;NEWBIT, NEWBT0, NEWBT1, NEWBT2, NEWBT3, NEWBT4, NEWBT5
NEWBIT: CAIG T,2
JRST NEWBTC
CAIL T,FACNT-2
JRST NEWBNC
NEWBT0: HRLI E,T
PUSH P,E
PUSH P,T
HRRI E,VBBITS
NEWBT1: HLRZ TT,(E)
CAME TT,(P)
JRST NEWBT2
MOVE T,[-4,,1]
MOVE TT,@E
CAMN TT,@-1(P)
AOBJN T,.-2
JUMPGE T,NEWBT4
HLRZ TT,(E)
NEWBT2: ADD TT,(P)
CAIE TT,FACNT
JRST NEWBT3
MOVE T,[-4,,1]
MOVE TT,FABITS(T)
ANDCM TT,@E
CAMN TT,@-1(P)
AOBJN T,.-3
JUMPGE T,[HRLI E,NOTBT!1000↔JRST NEWBT5]
NEWBT3: HRR E,(E)
TRNE E,-1
JRST NEWBT1
PUSH P,A
PUSH P,B
MOVEI B,6
PUSHJ P,SFSGET
MOVEI E,(A)
HRRZ A,VBBITS
HRRM E,VBBITS
HRRZM A,(E)
POP P,B
POP P,A
MOVE T,(P)
HRLM T,(E)
MOVEI T,1
MOVSI T,@-1(P)
HRRI T,1(E)
BLT T,4(E)
SETZM 5(E)
NEWBT4: HRLI E,1000
NEWBT5: SUB P,[2,,2]
POPJ P,
;NEWBTC, NEWBC1, NEWBC2, NEWBC3, NEWBNC, NEWBN1, NEWBN2, NEWBN3, NEWBCZ, NEWBNZ
NEWBTC: JUMPE T,NEWBCZ
CAIE T,2
JRST NEWBC1
SKIPE TT,3(E)
CAME TT,4(E)
JRST NEWBT0
TDNN TT,SLMOD2
JRST NEWBT0
NEWBC1: HRLI E,-4
SKIPE T,1(E)
JFFO T,NEWBC2
AOBJN E,.-2
JSP SARRGH
NEWBC2: HLRZ E,E
NEWBC3: HRRI E,4(E)
LSH E,5
ADDI E,(TT)
POPJ P,
NEWBNC: CAIL T,FACNT
JRST NEWBNZ
CAIE T,FACNT-2
JRST NEWBN1
MOVE TT,FABITS+3
ANDCM TT,3(E)
JUMPE TT,NEWBT0
TDNN TT,SLMOD2
JRST NEWBT0
XOR TT,4(E)
CAME TT,FABITS+4
JRST NEWBT0
NEWBN1: HRLI E,E
PUSH P,E
MOVE E,[-4,,1]
NEWBN2: MOVE T,FABITS(E)
ANDCM T,@(P)
JFFO T,NEWBN3
AOBJN E,NEWBN2
JSP SARRGH
NEWBN3: SUB P,[1,,1]
HRRI E,NOTBT⊗-5
MOVS E,E
JRST NEWBC3
NEWBCZ: TDZA E,E
NEWBNZ: MOVSI E,NOTBT
POPJ P,
;SCCOM, SCCNOT
SCCOM: HLLZ T,1(G)
HLR T,1(H)
TDNE T,[405000,,405000]
JRST SCCBIT
MOVE T,1(G)
XOR T,1(H)
TDNN T,[NOTBT,,-1]
JRST 4(E)
MOVE TT,1(G)
HLR TT,CTAB(TT)
TLNE T,NOTBT
JRST SCCNOT
TSNN TT,SLMODE
JRST .+3
TRNN T,¬40
JRST 4(E)
TLNN TT,NOTBT
JRST (E)
HRRZ TT,1(G)
JUMPE TT,2(E)
HRRZ TT,1(H)
JUMPE TT,3(E)
JRST 1(E)
SCCNOT: TSNE TT,SLMODE
TRNE T,¬40
TRNN T,-1
JRST (E)
TLNE TT,NOTBT
JRST 2(E)
JRST 3(E)
;SCCBIT
SCCBIT: PUSHJ P,MAKBIT
MOVEM TT,BITBF1(T)
EXCH G,H
PUSHJ P,MAKBIT
MOVEM TT,BITBF2(T)
EXCH G,H
MOVSI T,-4
MOVE TT,BITBF1(T)
TDNN TT,BITBF2(T)
AOBJN T,.-2
JUMPGE T,(E)
MOVSI T,-4
SETCM TT,BITBF1(T)
TDNN TT,BITBF2(T)
AOBJN T,.-2
JUMPL T,.+2
ADDI E,1
MOVSI T,-4
SETCM TT,BITBF2(T)
TDNN TT,BITBF1(T)
AOBJN T,.-2
JUMPGE T,3(E)
JRST 1(E)
;MAKBIT, MAKBT0, MAKBT1, MAKBTN, MAKBN2, MAKBTB, MAKBB3
MAKBIT: SKIPGE 1(G)
JRST MAKBBT
MAKBT0: LDB T,[330300,,1(G)]
XCT MBDSP(T)
SKIPG @(P)
JRST MAKBT1
MOVSI T,-4
XCT @(P)
AOBJN T,.-1
MAKBT1: HRRZ T,1(G)
LDB TT,[360100,,CTAB(T)]
ROTC T,-5
ROT TT,5
MOVE TT,BITTAB(TT)
MAKBTX: TDNN T,SLMODE
POPJ P,
XCT @(P)
XORI T,1
POPJ P,
MAKBTN: SKIPG @(P)
JRST MAKBN2
MOVSI T,-4
MOVE TT,FABITS+1(T)
XCT @(P)
AOBJN T,.-2
MAKBN2: HRRZ T,1(G)
MOVEI TT,
ROTC T,-5
ROT TT,5
SETCM TT,BITTAB(TT)
AND TT,FABITS+1(T)
JRST MAKBTX
MAKBTB: PUSH P,G
HRRZ G,1(G)
ADD G,[1(T)]
MAKBB3: MOVSI T,-4
MOVE TT,@G
XCT @-1(P)
AOBJN T,.-2
POP P,G
JRST POPJ1
BITTAB: FOR I←43,0,-1{1⊗I↔}
;MAKBNB, MAKBBT, MAKBB2, MBDSP, MBIND, MBIND2
MAKBNB: PUSH P,G
HRRZ G,1(G)
ADD G,[1(T)]
MOVSI T,-4
SETCM TT,@G
AND TT,FABITS+1(T)
XCT @-1(P)
AOBJN T,.-3
POP P,G
JRST POPJ1
MAKBBT: FOR I←0,3{SETZM MBBUF+I↔}
PUSH P,H
MOVE H,G
HRRZ G,(G)
MAKBB2: PUSHJ P,MAKBT0
IORM TT,MBBUF(T)
HLRZ G,(G)
CAIE G,(H)
JRST MAKBB2
EXCH H,(P)
MOVE G,[,MBBUF(T)]
JRST MAKBB3
MBDSP: MOVEI TT,
JRST MAKBTB
JRST MAKBTN
JRST MAKBNB
JRST POPJ1
JRST MBIND
JSP SBARF
JSP SBARF
MBIND: PUSH P,G
HRRZ G,1(G)
MOVSI T,(<XCT @>)
HRRI T,-1(P)
PUSH P,T
HRRI T,(P)
PUSH P,[JRST MBIND2]
PUSH P,T
JRST MAKBT0
MBIND2: SUB P,[2,,2]
POP P,G
JRST POPJ1
;SCGEN
SCGEN: HRRZ C,VBBITS
JUMPE C,.+2
PUSHJ P,SBTMAK
SKIPE B,SSVMAX
PUSHJ P,SFSGET
SUBI A,1
HRRM A,SSVINS
MOVEI B,440
PUSHJ P,SFSGET
HRLI A,(<XCT (C)>)
MOVEM A,SCXCT#
MOVE T,SRCNT
MOVEM T,SRCN1#
PUSHJ P,ENDSET
MOVEI T,1(A)
MOVEM T,SCODPT#
MOVSI T,(<JSP D,>)
HLLM T,SBKINS
MOVE B,SGPNT
TRNN F,SDELIM
TDZA E,E
MOVNI E,1
PUSHJ P,SCGEN1
MOVSI T,LOKBIT
MOVEI A,2(A)
FSFIX A,T
SUBI A,1
EXCH A,SFSLST
HRLM A,@SFSLST
JRST ENDFIX
;SCGEN1, SCGEN2, SCGEN3, SCGEN4, SCGEN5, SCGEN6
SCGEN1: MOVEI C,
SCGEN2: SKIPGE 1(B)
JSP SARRGH
HLRZ D,(B)
MOVEI T,1(A)
HRLM T,(B)
LEG PUSH A,D
TRNN F,SBKWDS
JRST SCGEN3
LEG PUSH A,[LSHC B,-7]
LEG PUSH A,[ROT C,7]
SCGEN3: LDB G,[330400,,1(B)]
CAIL G,4
JSP SARRGH
HRRZ H,1(B)
JUMPE H,SCGFA
LDB T,[330400,,1(D)]
CAIL T,4
ADDI G,4
PUSHJ P,SCGTST
HLL D,1(B)
CAIL G,4
AOBJP A,SCGEN5
PUSHJ P,SCGBK1
CAIN G,2
JRST SCGNC
SCGEN4: LDB T,[221100,,1(B)]
JUMPE T,.+3
ADD T,SSVINS
LEG PUSH A,T
MOVE T,1(B)
TLNE T,SGEBIT
JRST SCGE
HLL C,(B)
EXCH C,(B)
EXCH C,B
MOVSI T,1000
HLLM T,SBKINS
AOJA E,SCGEN2
SCGEN5: PUSH P,A
PUSHJ P,SCGHB
MOVEI T,(A)
ADD T,SBKINS
POP P,TT
MOVEM T,(TT)
JRST SCGEN4
;SCGTST, SCGT2, SCGT3, SCGDSP, SCGCN, SCGCN2, SCGBTN, SCGBT
SCGTST: XCT SCGDSP(G)
TDNN T,SLMODE
JRST SCGT2
HRLI H,(<CAIN C,>)
LEG PUSH A,H
MOVSI T,(<JRST>)
HRRI T,3+1(A)
LEG PUSH A,T
TDCA H,[<CAIE>≠<CAIN 40>]
SCGT2: HRLI H,(<CAIE C,>)
SCGT3:
LEG PUSH A,H
POPJ P,
SCGDSP: MOVE T,CTAB(H)
JRST SCGBT
JRST SCGCN
JRST SCGBTN
JRST SCGCN
JRST SCGBTN
MOVE T,CTAB(H)
JRST SCGBT
SCGCN: MOVE T,CTAB(H)
TDNN T,SLMODE
JRST SCGCN2
HRLI H,(<CAIE C,>)
LEG PUSH A,H
TDCA H,[<CAIE>≠<CAIN 40>]
SCGCN2: HRLI H,(<CAIN C,>)
JRST SCGT3
SCGBTN: SKIPA T,[TDNE (C)]
SCGBT: MOVSI T,(<TDNN (C)>)
MOVS TT,5(H)
HLR T,TT
TRZE TT,400000
TLC T,(<TDNN>≠<TDNE>)
CAMG TT,[CTAB,,-1]
TRNE G,2
TDZA H,H
MOVSI H,NSPEC
IOR H,BEG(TT)
TRNN H,-1
TROA H,(<MOVSI>)
TLOA H,(<MOVEI>)
MOVS H,H
LEG PUSH A,H
LEG PUSH A,T
POPJ P,
;SCGE, SCGE2, SCGEL, SCGBAK, SCGBK1, SCGBK2, SCGBK3, SCGFA, SCGNC, SCGNFA
SCGE: MOVSI T,(<MOVEI>)
HRRI T,(E)
LEG PUSH A,T
LEG PUSH A,[SOSG SRCN1]
LEG PUSH A,[JSP D,SRCHX]
HRRZ D,(B)
LDB G,[330400,,1(D)]
PUSHJ P,SCGBAK
SCGE2: MOVE D,SCXCT
HLRZ G,(B)
MOVE T,(G)
HRLM T,(B)
MOVEM D,(G)
JUMPE C,CPOPJ
SCGEL: EXCH C,B
HLRZ G,(B)
HRL C,(G)
MOVEM D,(G)
EXCH C,(B)
TRNE C,-1
JRST SCGEL
POPJ P,
SCGBAK: CAIL G,4
JRST SCGHB
SCGBK1: HLRZ T,(D)
ADD T,SBKINS
SCGBK2: TLNN D,NLDBIT
SOJA T,.+3
SCGBK3: TRNE F,SBKWDS
ADDI T,2
LEG PUSH A,T
POPJ P,
SCGFA: CAIGE G,2
JRST SCGNFA
SCGNC: MOVSI T,37740
HRRI T,2(A)
LEG PUSH A,T
JRST SCGEN4
SCGNFA:
LEG PUSH A,[JRST SRCHLX]
JRST SCGE2
;SCGHB, SCGHB0, SCGHB5, SCGHB1, SCGHB2, SCGHB3, SCGHB4, SCGHBX, SCGHX2
SCGHB: MOVEI T,(A)
LEG PUSH A,[MOVEM C,SBTST]
SCGHB0: HRLM T,(P)
LDB G,[330400,,1(D)]
CAIE G,XFRSAV
JRST SCGCB
SCGHB5: SUBI T,-774(A)
ROT T,-15
HRRI T,1+2(A)
LEG PUSH A,[MOVE C,SBTST]
LEG PUSH A,T
SCGHB1: HRRZ H,1(D)
LDB T,[221100,,1(H)]
JUMPN T,SCGHB3
MOVSI T,(<MOVEI C,>)
HRR T,1(H)
SCGHB2:
LEG PUSH A,T
LDB T,[221100,,1(D)]
ADD T,SSVINS
LEG PUSH A,T
HLL D,1(D)
HRR D,(D)
LDB G,[330400,,1(D)]
CAIGE G,4
JRST SCGHBX
CAIE G,XFRSAV
JSP SARRGH
JRST SCGHB1
SCGHB3: HRLI T,(<MOVE C,>)
ADDI T,@SSVINS
JRST SCGHB2
SCGHB4: CAIL G,4
JRST SCGHB5
SCGHBX: HLRZ T,(P)
SCGHX2: SUBI T,-774(A)
ROT T,-15
HLR T,(D)
LEG PUSH A,[MOVE C,SBTST]
AOJA T,SCGBK2
;SCGCB, SCGCB0, SCGCB1, SCGCB2, SCGCB3, SCGCB4, SCGCB5, SCGHCB
SCGCB: PUSH P,C
SCGCB0: MOVEI C,
SCGCB1: HRRZ H,1(D)
JUMPE H,[HLL D,1(D)↔HLR D,(D)↔JRST SCGCB3]
LDB T,[221100,,1(D)]
HRLI T,(<MOVE C,>)
ADDI T,@SSVINS
LEG PUSH A,T
TRZE G,REMTST
JRST SCGCB2
CAIE G,INDTST
JSP SARRGH
LDB G,[330400,,1(H)]
HRRZ H,1(H)
SCGCB2: CAIL G,4
JSP SARRGH
PUSHJ P,SCGTST
LEG PUSH A,C
MOVEI C,(A)
SCGCNO: HLRZ T,(D)
HLL T,1(D)
HRRZ D,(D)
SCGCB3: LDB G,[330400,,1(D)]
CAIL G,INDTST
JRST SCGCB1
PUSH P,T
CAIL G,4
JRST SCGHCB
HLRZ T,-2(P)
PUSHJ P,SCGHX2
SCGCB4: MOVSI H,(<JRST>)
TROA H,1(A)
SCGCB5: MOVEI C,(T)
MOVE T,(C)
MOVEM H,(C)
JUMPN T,SCGCB5
POP P,D
LDB G,[330400,,1(D)]
CAIL G,INDTST
JRST SCGCB0
POP P,C
HLRZ T,(P)
JRST SCGHB4
SCGHCB: HLRZ T,-2(P)
PUSHJ P,SCGHB0
JRST SCGCB4
;SBTMAK, SBTMK1, SBTMK2, SBTMK3, SBTMK4, SCGENB, SCGHB, SSVINS, SCXCT, SBKNW, SBKNWA, SBKDSP
SBTMAK: MOVEI B,200
PUSHJ P,SFSGET
MOVSI T,(A)
HRRI T,1(A)
SETZM (A)
BLT T,177(A)
MOVEI B,43
SBTMK1: HRLI A,BITTAB-BEG(B)
MOVEM A,5(C)
MOVE D,BITTAB(B)
HRLI C,-4
MOVSI G,TT
HRRI G,(A)
SBTMK2: SKIPE T,1(C)
JFFO T,SBTMK4
SBTMK3: ADDI G,40
AOBJN C,SBTMK2
HRRZ C,-4(C)
JUMPE C,CPOPJ
SOJGE B,SBTMK1
JRST SBTMAK
SBTMK4: IORM D,@G
ANDCM T,BITTAB(TT)
JFFO T,SBTMK4
JRST SBTMK3
IMPURE
SSVINS: MOVEM C,...
SBKINS: JSP D,1
SBKNW: SOJL A,...
SBKNWA: MOVE B,...(A)
SBKNWR: LSH B,-1
SBKNWX: JSP @
SBKDSP: REPEAT 4,<ADDI 3↔ROT C,7↔JSP @>
SBKNLX←.-1
JSP SBKNW
PURE
;SRCPAG, SRCPG1
;Note possible skip return
SRCPAG: MOVEI T,SRCHLX ;Entry from FINDIT (one page search)
SRCPG1: MOVEM T,SRCHLA# ;T has SCONTF not SRCHLX if from FIND
SRCPG2: MOVEI T,SBKNL
MOVE D,[SRCPGB,,SRCPGF]
PUSHJ P,SRCSET
MOVE T,ARRL
MOVEM T,SRCL#
MOVE A,ARRLIN
HRRZ T,2(A)
CAME T,SRCNUM
SETZM SRCOFF#
TRNE F,SBKWDS
JRST NOSRC2
MOVEM A,SRCLIN#
HRRZ E,SRCOFF
TRNE F,SDELIM
SUBI E,1
PUSHJ P,GBYTP
SKIPA C,[15]
ILDB C,A
MOVEI D,3
PUSHJ P,SCALL
POPJ P,
AOS (P)
JRST SCNBAK
SPFIN: MOVEI T,SPFX
MOVEM T,SRCHLA
SPFL: XCT SCXCT
LSHC B,-7
ROT C,7
CAIE C,15
AOJA E,SPFL
MOVE G
SPFL2: HRRZ T,@SRCLIN
MOVEM T,SRCLIN
AOS SRCL
SKIPGE 1(T)
JRST SPFL2
SPFX: MOVEM E,SRCOFF#
MOVE T,SRCLIN
HRRZ T,2(T)
MOVEM T,SRCNUM#
POPJ P,
NOSRC2: SORRY REVERSE SEARCHES NOT IMPLEMENTED
JRST SBARF2
;GBYTP, GBYTPL, GBTPX, GBPDSP, GBPTAB
GBYTP: CAIE A,BOTSTR
SKIPGE T,1(A)
POPJ P,
ADD A,[10700,,LLDESC-1]
TRNN T,777
ADD A,[340000,,1]
JUMPE E,POPJ1
JUMPL E,GBPNEG
MOVSI T,LSPC
MOVEI DSP,GBPDSP-2
GBYTPL: GETCH2 T,A
GBPTX: SOJG E,GBYTPL
JRST POPJ1
GBPNEG: MOVEI C,40
JRST POPJ2
GBPDSP: POPJ P,
JRST 4,.
JRST GBPTAB
JRST 4,.
GBPTAB: ILDB C,A
CAIE C,11
JRST GBPTAB
JRST GBPTX
BTAB3: 10700,,-10
100700,,-17
170700,,-26
260700,,-35
350700,,
;SRCPGF, SPFTAB, SPFCR, SPFLUZ
SRCPGF: 15↔JSP SPFCR
11↔JSP SPFTAB
177↔JSP SARRGH
0↔JSP SARRGH
SPFTAB: ILDB C,A
CAIE C,11
JRST .-2
ILDB C,A
JRST @
SPFCR: HRRZ A,@SRCLIN
CAIN A,BOTSTR
JRST @SRCHLA
MOVEM A,SRCLIN
AOS SRCL
SKIPGE B,1(A)
JRST SPFCR
TRNN B,777
TLOA A,350700
HRLI A,440700
ADDI A,LLDESC
ILDB C,A
JRST @
;SRCPGB, SPFTAB, SBKNL, SBKNUL
SRCPGB: 11↔JSP D,SPBTAB
0↔JSP SARRGH
SPBTAB: XCT @
LSHC B,-7
ROT C,7
CAIE C,11
JRST SPBTAB
MOVEI C,177
JRST -1(D)
SBKNL: HLRZ B,@SRCLIN
CAIN B,PAGE
JRST @SRCHLA
MOVEM B,SRCLIN
SOS SRCL
SKIPGE A,1(B)
JRST SBKNL
TRNN A,777
JRST SBKNUL
MOVEI A,LLDESC(B)
HRRM A,SBKNWA
HRRZ A,-LLDESC-1(A)
SUBI A,LLDESC+2+1
XCT SBKNWA
LSH B,-1
LSHC B,-7
JUMPN C,[ROT C,7↔SOJA SBKNWX]
SUBI 1
FOR I←0,3<LSHC B,-7↔JUMPN C,SBKDSP+1+3*I
> JSP SARRGH
SBKNUL: MOVEI C,15
MOVEI A,
ADDI 2
JRST SBKNLX
;SRCSET, SRCST1, SRCSTL, SRCST2
SRCSET: HRRM T,SBKNW
MOVEM D,SRCTYP#
SRCST1: MOVE A,SCXCT
TRNE F,SBKWDS
SKIPA T,[XCT @]
SKIPA T,[ILDB C,A]
MOVS D,D
MOVEM T,1(A)
MOVSI T,1(A)
HRRI T,2(A)
BLT T,177(A)
MOVE T,[JRST @40]
MOVEM T,200(A)
MOVSI T,200(A)
HRRI T,201(A)
BLT T,377(A)
SRCSTL: MOVE C,(D)
CAIGE C,200
JRST SRCST2
MOVE T,[JSP D,SOOPS]
MOVEM T,@A
SUBI C,200
SRCST2: MOVE T,1(D)
MOVEM T,@A
ADDI D,2
JUMPN C,SRCSTL
POPJ P,
;SCALL, SRCHX, SRCHLX
SCALL: MOVE T,SCXCT
ADDI T,200
MOVEM T,41
MOVEM SBTST
HRRZ SCXCT
ADDI SSPACS+1
MOVEM 1,@
HRLI 2
AOS 1,
BLT 16(1)
MOVE SBTST
MOVEM -2(1)
MOVE 1,-1(1)
ADD D,SCODPT
JRST @SCODPT
SRCHX: HRRZ 17,SCXCT
MOVE 16,SSPACS+P(17)
AOSA (16)
SRCHLX: HRRZ 17,SCXCT
MOVEM SSPACS+E(17)
MOVE SSPACS(17)
MOVSI 17,SSPACS+D(17)
HRRI 17,D
BLT 17,17
MOVE T,[PUSHJ P,UUOH]
MOVEM T,41
SKIPN ESCIEN
POPJ P,
OUTSTR [ASCIZ /
<ESC>I termination at end of page /]
SETZM TYOPNT
TYPDEC SRCPGS
POPJ P,
;SCNBAK, SCNBKL
SCNBAK: PUSH P,A
PUSH P,D
MOVE D,SRCTYP
TRC F,SBKWDS
PUSHJ P,SRCST1
POP P,D
POP P,A
TRCN F,SBKWDS
JSP SARRGH
LDB C,A
CAIN C,11
MOVEI C,40
MOVE B,(A)
TRNN F,OFFPAG
SKIPA T,SRCLIN
SKIPA T,[IBUF]
ADDI T,LLDESC
SUBI A,(T)
HRRM T,SBKNWA
LDB D,[370300,,A]
ANDI A,-1
MOVE D,BTAB(D)
LSH B,@BTAB3(D)
IMULI D,3
MOVE G,
MOVEI SBKDSP(D)
MOVEI D,SCNBKL+5
MOVE T,SCXCT
MOVEM T,SCNBKL
MOVSI H,NSPEC!LSPC
MOVEI DSP,SCBDSP
JUMPN E,SCNBKL
POPJ P,
IMPURE
SCNBKL: XCT ...(C)
LSHC B,-7
ROT C,7
TDNE H,CTAB(C)
XCT @CTAB(C)
SOJG E,SCNBKL
POPJ P,
PURE
SCBDSP: JRST SCNBKL
JSP SARRGH
JFCL
JRST SCNBKL
JFCL
JRST SCNBKL
JFCL
;SCONTF, SRCFNP, SRCFNB, SFNB2, SFRETR
SCONTF:
MOVE D,
ADDI D,2
JSP A,SGTACS
PUSH P,T
PUSH P,D
MOVEI T,SBKNB
MOVE D,[SRCFB,,SRCFF]
PUSHJ P,SRCSET
POP P,D
POP P,T
TRO F,OFFPAG
MOVE A,DIRPT
MOVEM A,SDIRPT#
MOVE A,CURPAG
MOVEM A,SRCPG#
JSP A,SRTACS
SRCFNP:
HRRZ A,@SDIRPT
CAIN A,DIREND
JRST SRCHLX
SKIPN ESCIEN
JRST SRCFP2
MOVE T,SRCPG
MOVEM T,SRCPGS#
JRST SRCHLX
SRCFP2: MOVEM A,SDIRPT
AOS SRCPG
SKIPN A,1(A)
JRST SIOERR
MOVEI C,-1(A)
CAME C,IBLK
XCT %SETI
MOVEM C,IBLK
ANDCMI A,-1
ROT A,7
ADD A,IBFPNT
IBP A
JRST SFNB2
SRCFNB: HRRZ A,@SDIRPT
HRRZ A,1(A)
SUBI A,1
CAMG A,IBLK
JRST SRCFNP
MOVE A,IBFPNT
SFNB2:
XCT %IN
AOSA IBLK
JRST SIOERR
SFRETR: HLRZ C,-3(D)
CAIE C,(<XCT (C)>)
SOJA D,SFRETR
MOVEI C,40
JRST -3(D)
;SRCFF, SFFNUL, SGTACS, SRTACS
SRCFF: 377↔JRST SRCFNB
212↔JRST SFRETR
200↔JRST SFFNUL
SFFNUL: SKIPE (A)
JRST SFRETR
SKIPN 1(A)
AOJA A,.-1
HRLI A,700
JRST SFRETR
SSPACS←←400
SSSACS←←420
SGTACS: EXCH A,SCXCT
MOVE F,SSPACS+F(A)
MOVEM P,SSSACS+P(A)
MOVE P,SSPACS+P(A)
EXCH A,SCXCT
JRST (A)
SRTACS: EXCH A,SCXCT
MOVEM F,SSPACS+F(A)
MOVE P,SSSACS+P(A)
EXCH A,SCXCT
JRST (A)
SOOPS: HLL D,40
TLNN D,¬1000
XCT SCXCT
LSH C,22-15
HLL C,D
ROT C,15
ADDI D,-774(C)
HLRZ C,C
XCT SCXCT
;SRCFB, SFBNUL, SBKNB, SBKNB2, SIOERR, SBKNP
SRCFB: 14↔JRST SFBNUL
12↔JRST SFBNUL
0↔JRST SFBNUL
SFBNUL: HLRZ C,-5(D)
CAIE C,(<XCT (C)>)
SOJA D,SFBNUL
MOVEI C,177
JUMPN B,-5(D)
MOVEI -5(D)
SOJL A,SBKNB
SKIPN B,@SBKNWA
SOJGE A,.-1
JUMPGE A,SBKNWR
SBKNB: MOVE A,SDIRPT
HRRZ A,1(A)
CAML A,IBLK
JRST SBKNP
SBKNB2: SOS A,IBLK
XCT %SETI
MOVEI A,177
XCT %IN
JRST SBKNWA
SIOERR: OUTSTR [ASCIZ \SEARCH I/O ERROR.
\]
JRST SRCHLX
SBKNP: JSP SBARF
;JFILL, JUST, JUSTL1, JUSTL2, JDISP
JFILL: TROA F,NEG ;Neg flag to 1 for JFILL case.
JUST: TRZ F,NEG ;Neg flag to zero for JUST case.
TLZ F,INDEN!ALIN!CEN ;To prevent trouble
TRNE F,ATTMOD!ARG ;Are we in attach mode or has an argument been given?
JRST .+7 ;Yes, so leave page alone.
PUSH P,A ;Needed later.
PUSH P,B
MOVNI A,20 ;To back up a reasonable distance.
PUSHJ P,WIND ;This does all that should be necessary.
POP P,B
POP P,A
;CENTER enters at this point.
JUST1: PUSHJ P,JUSMAR ;Check on margin changes.
;ALINE,JLEFT and INDENT enter at this point.
JUST2: TRNE F,ATTMOD ;Are we in ATTACH mode?
SKIPA E,[JATAB] ; Yes so put [JATAB] in E.
MOVEI E,JPTAB ; No so put [JPTAB] in E.
TRNN F,ARG ;Is there an argument?
TROA A,-1 ; No so set A to -1
SKIPA D,@JPT1(E) ; Yes so put contents of @ATTBUF or @ARRLIN in D.
MOVE D,@JPT2(E) ; No so put contents of @ATTBUF or @,PAGE into D.
JUMPLE A,CPOPJ ;POPJ P, if no argument in A.
MOVEM A,JCNT# ;Count of lines attached into JCNT.
HRRZM D,JPTR# ;Location of source line of text in JPTR.
PUSHJ P,REMPTR ;
HLRZ A,(D) ;Left half of (D) into right half of A
HRLZM A,JLPT# ; and then into left half of JLPT.
MOVSI T,JPTR
HLLM T,(D)
MOVEI T,JLPT
HRRM T,(A) ;Manufactured pointer to original text.
MOVE D,[440700,,BUF] ;Pointer to start of BUF into D.
MOVEM D,JWPT# ;Save BUF pointer at start.
SETZB B,JWCOL#
SETZM JBUGR#
PUSHJ P,JSET ;JSIZE←RMAR-LMAR+1, JSCNT←0, H←LSPC, DSP←JDISP.
SETOM BUF2 ;Fill BUF2 with 1's.
MOVE T,[BUF2,,BUF2+1]
BLT T,BUF2+37
PUSHJ P,NXTLN2 ;Locate first line of text.
JRST JFIX
JFCL
PUSHJ P,JUSTL0 ;To eat up some leading spaces and TABs.
;Put no code in here as JCRTB:+1 contains equivalent of a JRST JUSTL1-1,
;and JUSTL0 returns to JUSTL1+1.
JUSTL1: GETCH2 H,A ;Next char from text, to PUSHJ P, DUMP on
; nul, to JUSTCR on CR, on BS to JUSTL1,
CAIN C,40 ; to JTAB on TAB, and halt otherwise.
JRST JUSTSP ;To JUSTSP on space.
JUSTLX: CAIN C,11
JRST JUSTTB ;To JUSTTB on TAB.
JUMPGE B,JUSTL3 ;To JUSTL3 if count ≥ JSIZE.
JUSTL2: IDPB C,D ;Put char into BUF.
AOBJN B,JUSTL1 ;Loop
JRST JUSTL1
JUSTL3: IDPB C,D ;Put last char into BUF.
JUSTL4: SKIPL JWPT ;Are we allowed more?
PUSHJ P,JDUMP ;No, time to dump BUF
JRST JUSTL1 ;Yes
;This section takes care of leading spaces and TABs during the transfer of the
; text to BUF. All spaces and TABs are eaten for ALINE and CENTER. TABs only
; are eaten for INDENT and extra spaces are removed as requested. Required
; extra spaces are added for INDENT, ALINE and CENTER later by JULMAR.
; Leading spaces up to the first non-space are eaten for JUST and JFILL.
JUSTL0: TLNE F,JOINF
POPJ P, ;This preserves first line left margin.
AOS (P) ;Must always skip 1 on return.
TLNN F,CEN!ALIN!INDEN
JRST JUSTLA
TLNN F,INDEN
JRST INDE5
SKIPLE T,INMAR ;Is INDENT to be to right or left?
JRST INDE2 ;To the right so let JULMAR do it.
INDE4: ILDB C,A ;The negative INDENT case
CAIN C,11
JRST INDE4 ;Eat TABs as usual
CAIE C,40
POPJ P, ;Into the second command in GETCH2 macro.
AOJLE T,INDE4 ;and also eat INMAR spaces if possible.
JRST INDE3 ;To finish eating TABs.
INDE2: ILDB C,A
CAIN C,11
JRST INDE2 ;Eat up all TABs for INDENT case
CAIE C,40 ;but save all remaining spaces.
POPJ P, ;Into second command in GETCH2
INDE3: IDPB C,D
AOBJN B,INDE2
INDE5: ILDB C,A ;ALINE and CENTER are handled differently
CAIE A,40
CAIN C,11
JRST .-3 ;Eat up all leading spaces and TABs
CAIE C,15
POPJ P, ;Into second command in GETCH2 macro.
MOVEI C,40
IDPB C,D
MOVEI C,15
POPJ P,
JUSTLA: ILDB C,A ;Eat spaces and TABs for JUST and JFILL
CAIE C,40 ;New 1/3/75
CAIN C,11
JRST JUSTLA ;Eat it up.
POPJ P, ;Yes, into the middle of GETCH2 macro.
;Dispatch table (BUF→BUF2) for JUST and JFILL
;DSP is set to JDISP in JSET4 (also set to JDISP2 in JDMP2) and used in
; JUSTL1 (in GETCH2 macro) to dispatch on special characters via CTAB.
JDISP: PUSHJ P,JDUMP ;JDUMP on NULL
JRST JUSTL1 ;Overwrite last char on BS.
PUSHJ P,JUSTCR ;JUSTCR on CR
JRST 4,.
JSP T,JTAB ;JTAB on TAB
JRST 4,.
;Dispatch table (BUF→BUF2) for CENTER and JLEFT.
;DSP is set to JNDISP in JSET4.
JNDISP: PUSHJ P,JDUMP ;JDUMP on NULL
JRST JUSTL1 ;Overwrite last char on BS.
PUSHJ P,JNOCR ;We require special treatment in this case.
JRST 4,.
JSP T,JTAB ;JTAB on TAB
JRST 4,.
;Dispatch table (BUF→BUF2) for ALINE and INDENT
JADISP: PUSHJ P,JDUMP ;JDUMP on NULL
JRST JUSTL1 ;Overwrite last char on BS.
PUSHJ P,JNOCR ;We require special treatment in this case.
JRST 4,.
JSP T,JALTAB ;ALINE and INDENT must eat interior TABs.
JRST 4,.
JALTAB: JRST (T)
;To handle the end of the line as signalled by a CR,
; in CENTER, ALINE, JLEFT and INDENT.
; This is where the correct value for the left margin is determined to meet the
; requested shift if it can be done without exceeding the LINE BUFFER capacity.
; The actual shift is still left to JULMAR.
JNOCR: MOVEI T,
IDPB T,D ;Put a null into BUF.
MOVNI B,(B)
TLNN F,CEN
JRST JNOCR2 ;ALINE or INDENT
ADD B,RMAR
SKIPG B
MOVEI B,1 ;B must be left positive
ASH B,-1
ADD B,LMAR
MOVEM B,TMPMAR
JRST JNOCR3
JNOCR2: ADD B,JSIZE2 ;ALINE and INDENT allowed more space than CENTER.
TLNN F,INDEN
SKIPA T,AMAR ;Use AMAR for ALINE case
MOVE T,INMAR ;but use INMAR for INDENT case.
SUB B,T ;Allow for margin shift
SKIPG B ;May still be space
ADD T,B ;Unfortunately not so decrease T.
MOVEM T,TMPMAR ;Get new shifted margin.
JNOCR3: PUSHJ P,JFLUSH
JRST JUSTCR
;JUSTTB, JUSTSP, JUSTS2, JUSTSL, JUSTS3, JUSTSO, JSTSO2, JULMAR
JUSTTB: TLNE F,ALIN!INDEN
JRST JUSTL1 ;We eat up all TABs in ALINE and INDENT cases.
MOVEI C,40
JUSTSP: TLNE F, ALIN!INDEN
JRST JUSTLX ;and save all spaces.
HRRZM B,JWCOL
MOVEM D,JWPT
LDB T,D
CAIG T,"?" ;Eliminate most usual chars first
CAIGE T,"!" ;Now do the same for quite a few more
JRST JUSTS2 ;Save only one space for all of these.
MOVE T,BITTAB-40(T) ;Now test remaining cases for punctuation.
TDNN T,[200010000020] ;Special treatment for . ! and ? only.
JRST JUSTS2 ;Nope not any of these so save only one space.
HLRO T,B
MOVNS T
CAIG T,2
JRST JUSTS2 ;Assume that there is not room for spaces and char.
AOS JSCNT
IDPB C,D ;Save space and maybe a second one.
AOBJP B,.+5
JFCL ;Needed to permit JRST -4(T) in JCRTB+1
GETCH2 H,A
CAIN C,40
JRST JUSTS2 ;Prepare to save second space and to eat any more.
CAIE C,11
JRST JUSTS3
JUSTS2: AOS JSCNT
IDPB C,D ;This is the last one to be saved.
AOBJP B,.+5
JFCL ;Needed to permit JRST -4(T) in JCRTB+1
JUSTSL: GETCH2 H,A
CAIE C,40
CAIN C,11
JRST JUSTSL ;Continue to eat if more spaces or TABs
JUSTS3: JUMPL B,JUSTL2
IDPB C,D
PUSHJ P,JDUMP
JRST JUSTL1
JULMAR: PUSH P,T ;May not be needed, but what the heck.
MOVE T,TMPMAR ;This routine fixes the left margin.
TLNE F,INDEN
ADDI T,1 ;To jibe with ALINE convention.
SOJLE T,.+5 ;Is left margin to be moved in?
MOVEI C,40 ;Yes, put in some spaces.
IDPB C,A ;Put into BUF2.
ADDI G,1 ;Account for addition
SOJG T,.-2
POP P,T
POPJ P,
JUSMAR
JUSMAR: PUSH P,A ;A contains a wanted argument, so save.
PUSH P,E ;So may E.
MOVE T,EXTPNT ;To read margin changing instructions.
MOVEM T,TYIPNT ;Set pointer.
HRLI C,(<MOVEI C,>)
MOVEM C,TYIINS
SETZB A,C
PUSHJ P,TYI ;Get first character if any.
JRST JUSTM6 ;We are to use default values.
CAIN C," "
JRST .-3 ;Ignore an extra space in here.
MOVEI E,
SETZM LMAR ;Clear for use.
SETZM PMAR
SETZM RMAR
MOVNI TT,3 ;Allow only 3 characters.
CAIN C,","
JRST JUSMA ;To insure correct handling of JMAR.
JRST JUSMA1
JUSMAX: MOVNI TT,3 ;Only allow 3 characters.
SETZB A,C ;Character to C and binary number to A.
PUSHJ P,TYI
JRST JUSMA4
JUSMA1: CAIG C,71
CAIGE C,60
JRST JUSMA5
IMULI A,12
ADDI A,-"0"(C)
CAILE A,=118 ;Allow only 118 columns.
MOVEI A,=118
JUSMA2: PUSHJ P,TYI
JRST JUSMA4 ;We must find out where we stopped.
JUSMA3: AOJN TT,JUSMA1
SORRY 120 characters maximum.
JRST JUST10
JUSMA4: CAIN C,175
JRST JUST10
CAIE C,12
JRST JUSMA5 ;We seem to be through.
JRST JUSMA2 ;Swallow extraneous character.
JUSMA5: SKIPE PMAR
JRST JUSTM3
CAIN C,"+"
AOJA E,JUSMAX
CAIN C,"-"
SOJA E,JUSMAX
JUMPE E,JUSTM2 ;This must be an absolute setting.
SKIPG E ;The change is positive.
MOVNS A
ADD A,LMARS ;Make into a tentative absolute
JUSTM1: MOVEM A,PMAR ;E not zero retains info as to temporary nature.
CAIN C,15
JRST JUSM6A ;Sticky values from here on.
JRST JUSMAX
JUSTM2: JUMPN A,JUSTM1
JUSMA: MOVEI E,10 ;Flag to change PMAR if LMAR is changed.
MOVE A,PMARS
JRST JUSTM1
JUSTM3: SKIPE LMAR
JRST JUSTM4 ;LMAR has already been set.
SKIPN A ;We have a value to use.
MOVE A,LMARS ;We are to use sticky value
MOVEM A,LMAR ;So store it.
JUMPE E,JUSM3
ADD A,PMAR ;PMAR was only temporary,
SUB A,LMARS ;correct for change in LMAR
MOVEM A,PMAR
JUSM3: CAIN C,15
JRST JUSM6B ;Sticky values from here on.
JRST JUSMAX
JUSTM4: SKIPE RMAR
JRST JUSTM6 ;We should never have gotten here.
SKIPN A ;A new value.
MOVE A,RMARS ;Must use the sticky value.
MOVEM A,RMAR
JRST JUSTM5
JUSTM6: MOVE A,PMARS
MOVEM A,PMAR
JUSM6A: MOVE A,LMARS
MOVEM A,LMAR
JUSM6B: MOVE A,RMARS
MOVEM A,RMAR
JUSTM5: CAMG A,LMAR ;Now check if sensible.
JRST JUST10 ;Naughty naughty.
CAMG A,PMAR
JRST JUST10 ;Naughty naughty.
MOVEI A,1
CAMLE A,PMAR
MOVEM A,PMAR ;Can not be less than 1.
JRST JUSTM7
JUSTM7: CAIE B,3 ;Sticky command (used COMTROL and META).
JRST JUSTM8 ;Changes only temporary
MOVE A,PMAR
MOVEM A,PMARS
MOVE A,LMAR
MOVEM A,LMARS
MOVE A,RMAR
MOVEM A,RMARS
JUSTM8: MOVE A,RMAR
SUB A,LMAR
MOVEM A,JSIZE2 ;Must start out right in case it does not get set.
POP P,E ;We still want this.
POP P,A ;We still want the argument in A.
POPJ P,
JUST10: SORRY default margin values used.
JRST JUSTM6
;JUSTCR, JCRTB, JCR2, JFIX, JPTAB, JATAB
;Entered from JUSTL1 via JDISP on each CR in text.
JUSTCR: LDB T,D
CAIN T,40
JRST JUSCR2
HRRZM B,JWCOL
MOVEM D,JWPT
CAIG T,"?" ;Eliminate most usual chars first
CAIGE T,"!" ;Now do the same for quite a few more
JRST JUSCR2 ;Introduce only one space for all of these.
MOVE T,BITTAB-40(T) ;Now test remaining cases for punctuation.
TDNN T,[200010000020] ;Special treatment for . ! and ? only.
JRST JUSCR2 ;Nope not any of these.
MOVEI T,40
IDPB T,D ;We assume that 2 spaces will be wanted.
AOBJN B,.+1
JUSCR2: PUSHJ P,NXTLIN
JRST JCR2
JRST JCRTB
TLNE F,INDEN!CEN!ALIN
JRST .-2
MOVEI C,40
POPJ P,
JCRTB: POP P,T
JRST -4(T) ;This was changed Oct 16 1974 from -3 with JUSTL0:
;and again from -7 to -4 on Nov.2.
JCR2: SUB P,[1,,1]
PUSHJ P,JFLUSH
PUSHJ P,JFIX
JRST JEXIT(E)
JFIX: HLRZ T,JLPT
MOVE TT,JPTR
HRRM TT,(T)
HRLM T,(TT)
JRST FIXPTR
JPT1←←0
JPT2←←1
JETST←←2
JLPTR←←3
JCPTR←←4
JEXIT←←5
JPTAB: ARRLIN
,PAGE ;STUPID FAIL
BOTSTR
LINES
CHARS
PUSHJ P,LINSET
JRST SETWRT
JATAB: ATTBUF
ATTBUF
ATTBUF
ATTNUM
ATTSIZ
MOVE T,ATTNUM
CAILE T,ATTMAX
MOVEI T,ATTMAX
PUSHJ P,EXSET
JRST ATTWRT
IMPURE
TMPMAR: 1 ;Temporary margin for one line only.
LMAR: 1 ;Left justifying margin.
PMAR: 1 ;Paragraph margin.
RMAR: =69 ;Right justifying margin.
LMARS: 1 ;Sticky left margin.
PMARS: 1 ;Sticky paragraph margin.
RMARS: =69 ;sticky right margin.
DTBCNT: 0
DSPCNT: 0
INMAR: 4
INMARS: 4 ;Sticky INDENT parameter
AMAR: 1
AMARS: 1 ;Sticky ALINE margin
RJMARS: =80 ;Sticky JOIN right margin allows room for some editing.
PURE
;NXTLIN, NXTLN2, JTAB, NXTBL
;We PUSHJ P enter here from JUSTCR and prepare for a new line of text.
;At entry JPTR points to the last line processed. The first task is to update
;JPTR to point to the next line by adding the word count contained in the
;first byte in right half of the second header word. The count of the lines
;yet to be processed (in LINES or ATTNUM) is decremented by 1. The back pointer
;in the new line entry is set to point to JPTR. FSGIVE is then entered to give
;up the storage just made available and we fall through to NXTLN2.
NXTLIN: MOVE A,JPTR ;Location of line
LDB T,[111100,,1(A)] ;Get 2nd 9 bits from right of 1(A)
MOVNI T,(T) ;and do 1's complement of T
ADDM T,@JCPTR(E) ;add this to # in CHARS or ATTSIZ.
SOS @JLPTR(E) ;Subtract 1 from # in LINES or ATTNUM.
HRRZ C,(A) ;Get line forward pointer
MOVEM C,JPTR ;and put it in JPTR.
MOVSI T,JPTR ;with JPTR location in left half
HLLM T,(C) ;of pointer for line pointed to.
PUSHJ P,FSGIVE ;Give up storage space.
;We PUSHJ P enter at this point on the first line of text from JUST,
; fall through from above after returning from FSGIVE and
; re-enter from the end of NXTBL to which we branch (7 lines down).
NXTLN2: MOVE A,JPTR ;Location of next line to be treated
SOSL JCNT ;Have we treated the required # of lines?
CAIN A,@JETST(E) ;At the end of the page if not ATTACHED?
POPJ P, ;Yes, so use first return.
SKIPL T,1(A) ;Is there room for it in the buffer?
TRNN T,777
JRST NXTBL ;No, so flush and reset
AOS (P) ;Set for second return.
ADD A,[440700,,LLDESC] ;Sets A pointer to place to start text.
TRNE F,ALIN!CEN!INDEN
JRST [TLZN F,TF1↔AOS (P)↔POPJ P,] ;(TF1←0) if TF1=0 3rd else 2nd return.
MOVE T,A
ILDB T,T ;Look at the first character.
CAIN T,"."↔JRST JCMLIN ;If "." JFLUSH , set TF1 to 0, 2nd return.
CAIE T,11 ;If not TAB
JRST [TLZN F,TF1↔AOS (P)↔POPJ P,] ;(TF1←0) if TF1=0 3rd else 2nd return.
PUSHJ P,JFLUSH ;If TAB indicating a new paragraph
TLZ F,TF1 ;Set TFI to zero
MOVE T,PMAR
CAIE T,1 ;Eat TAB if PMAR≠1
JRST NXTLN3
ILDB C,A
IDPB C,D ;Save first TAB.
ADD B,[10,,10] ;Count as 8 spaces.
POP P,T ;Put the return address into T
JTAB: ILDB C,A ;Get next character
CAIE C,11
JRST JTAB ;Eat up all characters up to the next TAB.
JRST (T) ;T should contain return address.
;Note that JTAB is also entered via the dispatch table JDISP
; on interior TABS from JUSTL1, JUSTSP+14 and JUSTSL.
NXTLN3: MOVEI C,40
SOS T
IDPB C,D ;Introduce PMAR-1 spaces
AOBJN B,.+1
SOJG T,.-2
ILDB C,A
CAIE C,40 ;And eat all existing TABs and spaces
CAIN C,11
JRST .-3
IDPB C,D ;Save the first good character
AOBJN B,.+1 ;And account for it
POPJ P,
JCMLIN: PUSHJ P,JFLUSH
TLZ F,TF1
MOVE T,PMAR
CAIN T,1
POPJ P,
SOS T
ILDB C,A ;Eat the period in this case
MOVEI C,40 ;and replace by PMAR-1 spaces
IDPB C,D
AOBJN B,.+1
SOJG T,.-2
ILDB C,A
CAIN C,40
JRST .-2
IDPB C,D ;But save first non blank
AOBJN B,.+1
POPJ P,
;We JRST here from NXTLN2
; if JCNT ≥ 1 and JPTR ≠ JETST(E) otherwise we POPJ P,
; and IF 1(JPTR) LAND 777 = 0 otherwise we stay in NXTLN2.
NXTBL: PUSHJ P,JFLUSH
HRRZ C,(A) ;Get forward pointer
MOVEM C,JPTR ;Store it at JPTR
MOVSI T,JPTR
HLLM T,(C) ;And store location as backward pointer at (C)
MOVSI T,JLPT ;Now get location JLPT in left half of T
HLR T,JLPT ;and contents of left half of JLPT
MOVSM T,(A) ;into (A) switched
HRRM A,(T) ;now right half of a into right of (T)
HRLZM A,JLPT ;and into left of JPLT
HRLI B,(B)
MOVN T,PMAR ;Start line at paragraph margin position.
PUSHJ P,JSET2
TLO F,TF1
JRST NXTLN2
;JDUMP, JDMP2, JDLT, JDL1, JDISP2
;Entered from JUSTL3 and from JUSTS3 by PUSHJ P.
JDUMP: MOVEI T,
IDPB T,D ;Put a null in BUF, just in case.
TRNN F,NEG ;Skip to JDMP2 for JFILL case
SKIPN TT,JSCNT ;Skip to JDMP2 for JUST case if JSCNT=0
JRST JDMP2
MOVE T,JWPT ;Start at current value for JWPT and
ILDB C,T
CAIN C,40 ;count number of spaces.
SOJA TT,.-2
MOVEM TT,JSCNT ;JSCNT has been decreased by # of spaces
MOVE T,JBUGR#
ADDI T,3
ANDI T,7
MOVEM T,JBUGR ;JBUGR (mod 8) increased by 3.
MOVE T,JSIZE
SUB T,JWCOL
JUMPG T,.+2
TDZA T,T ;Set T to 0 if JSIZE ≤ JWCOL
LSH T,3 ;Multiply T by 8 if JSIZE > JWCOL
JDMP2: MOVEM T,JSINC# ;JSINC←0 if JFILL case or if JSIZE ≤ JWCOL.
PUSH P,A ;Save A on P stack
MOVE D,JWPT ;Restore D to JWPT value.
ILDB T,D ;Remove character from BUF
PUSH P,T ; save it on P stack
MOVEI T, ; and
DPB T,D ; replace it by a nul.
SETZM JSIZE
SETZM JWPT
SETZB B,G
MOVSI H,LSPC!NSPEC ;Flags in H for all special characters.
MOVEI DSP,JDISP2 ;DSP is used in GETCH2 macro.
MOVE D,[440700,,BUF] ;Reset BUF pointer to start of BUF.
SKIPA A,[440700,,BUF2] ;Reset BUF2 pointer for output and go to JDL1
JDLT: JSP TT,JDTAB ;Save PC in TT and jump to JDTAB.
PUSHJ P,JULMAR ;Left margin adjust.
TLNN F,ALIN!CEN ;We must eat as usual.
JRST JDL1
ILDB C,D
CAIE C,40
CAIN C,11
JRST .-3
JUMPN C,JDLT1+1 ;Was there nothing but spaces?
MOVEI C,40 ;Yes
IDPB C,A ;Then put one space back
MOVEI C,0
JRST JDLT1+1
JDLT1: GETCH2 H,D
IDPB C,A
AOJA B,JDLT1
;The padding ahead of GETCH2 used with dispatch table JDISP is no longer needed
;since DSP has been reset to JDISP2 in JDLT-3 above.
JDL1: GETCH2 H,D ;Next char from BUF, to JDFIN on NUL
CAIN C,40 ; and to JDLT on TAB.
JRST JDSP1 ;Exit from loop on space
IDPB C,A ;Character to BUF2.
AOJA B,JDL1 ;Loop during word block.
;DSP set to JDISP2 in JDMP2 (also set to JDISP in JSET2).
;Note this dispatches to JDFIN on NUL, to JDLT on TAB
; and halts on anything else. Used in JDL1 (in GETCH2 macro).
JDISP2: JRST JDFIN
JRST 4,.
JRST 4,.
JRST 4,.
JRST JDLT
JRST 4,.
;JDSP1, JDSP2, JDSP3, JDTAB, JFLUSH
JDSP1: MOVE T,JSINC
ADDB T,JSIZE
IDIV T,JSCNT
ADD T,JBUGR
LSH T,-3
SUB T,JWPT
ADDM T,JWPT
ADDI T,1(B)
JRST JDSP2A; MOVEI TT,1(B)
TRNE TT,7
JRST JDSP2
IDPB C,A
ADDI B,1
JDSP2: MOVEI TT,(T)
ANDCMI TT,7
CAILE TT,(B)
JRST JDSP3
JDSP2A: SUBM B,T
JUMPE T,JDL1
HRLI B,(T)
IDPB C,A
AOBJN B,.-1
JRST JDL1
JDSP3: PUSH P,T
MOVEI C,11
JSP TT,JDTAB
MOVEI C,40
POP P,T
JRST JDSP2
;Entered by JSP TT, from JDLT (as dispatched by JDISP2) and from JDSP3
;Used to introduce extra spaces as required.
JDTAB: IDPB C,A
ADDI G,(B)
HRLI B,(B)
TLO B,-10
MOVEI T,40
IDPB T,A
AOBJN B,.-1
SUBI G,-1(B)
IDPB C,A
JRST (TT)
JFLUSH: JUMPL D,CPOPJ
MOVEM D,JWPT
SETZB T,TT
IDPB T,D
JRST JDMP2
;JDFIN
;JDFIN finishes off BUF2 by adding a CR, a LF, a NULL and as many more NULLs
;as are needed to pad out the last word. The necessary header and trailer
;words are generated, FSGET is entered to get the necessary free storage for
;the new line and this is BLTed out.
;Entered from JDL1 via JTAB and JDISP2 on a NULL.
JDFIN: MOVEI C,15
IDPB C,A ;Add a CR to text in BUF2.
MOVEI C,12
IDPB C,A ;Add a LF.
TDZA C,C
IDPB C,A ;Add a NULL.
TLNE A,760000
JRST .-2 ;Continue to end of word.
AOS @JLPTR(E) ;Add 1 to value in LINES or ATTNUM
ADDI G,2(B) ;Increase G by 2 + # of characters
ADDM G,@JCPTR(E) ;Add this to value in CHARS or ATTSIZ.
LSH G,11 ;Move G to byte position.
IORI G,(B) ;IOR in the actual char count.
MOVEI B,-BUF2+1+LLDESC(A) ;Number of words.
PUSHJ P,FSGET ;Get space to store line.
MOVSI TT,BUF2 ;Starting location of source
HRRI TT,LLDESC(A) ;and starting location of destination.
BLT TT,-2(T) ;and now BLT, ending at location -2(T)
MOVSI T,TXTCOD ;A fancy way to store 2 in left half!
HLLM T,-1(A) ;To 1st header word.
HRRZM G,1(A) ;Char. cnts in right of 3rd header word.
AOS T,TXTNUM
MOVEM T,2(A) ;To 4th header word.
HLRZ T,JLPT
CAIE T,PAGE
SKIPGE 1(T)
TRO F,UPDTXT ;Flag change in first line.
HRLI T,JLPT
MOVSM T,(A)
HRRM A,(T)
HRLZM A,JLPT
MOVE A,D
MOVE D,[440700,,BUF]
MOVEM D,JWPT
SETZM JWCOL
POP P,C
TDZA B,B ;Tricky way to set to zero and skip.
ILDB C,A
CAIN C,40 ;Is there a superfluous CR?
JRST .-2 ;Yes.
JUMPE C,JDFIN2
IDPB C,D ;Put unused part back into BUF.
ILDB C,A
AOBJP B,.-3
JRST JDFIN2
;JDFIN2, JSET, JSET2
;We enter at JDFIN2 from end of JBFIN or from 4 lines earlier if C is NULL.
JDFIN2: POP P,A
;We enter at JSET from JUST only. This is before BUF is loaded.
JSET: MOVN T,LMAR
;We enter at JSET2 from NXTBL which in turn is entered from LXTLN2
; if T LAND 777 =0 which means the start of a block.
;Note:the next two instructions ane new oct.23,74.
JSET2: MOVNM T,TMPMAR ;We arrive here with - the correct margin in T
ADD T,RMAR
JSET4: ADDI T,1
TLNE F,INDEN!CEN!ALIN!JOINF ;Test for non-filling flags
MOVE T,JSIZE2
MOVEM T,JSIZE#
MOVSI T,(T)
SUB B,T
SETZM JSCNT#
MOVSI H,LSPC
MOVEI DSP,JDISP ;Used only for JUST and JFILL
TLNE F,CEN
MOVEI DSP,JNDISP ;Special dispatch table for this case
TLNE F,INDEN!ALIN
MOVEI DSP,JADISP ;Special dispatch table for these cases
POPJ P,
;INDENT,ALINE,CENTER,JLEFT
;INDENT applies to a specified number of lines if an argument is given otherwise
; to the entire ATTACH buffer or to a single line if not in ATTACH mode.
INDENT: TRO F,NEG ;Inhibit padding.
TLZ F,CEN!ALIN!JOINF
TLO F,INDEN
PUSHJ P,LEFMAR
TRNE F,ARG
JRST JUST2 ;The argument takes precedent.
TRNN F,ATTMOD ;Are we in ATTACH mode?
TRO F,ARG ;No, so set flag
JRST JUST2 ;Yes, so do entire ATTACH buffer.
;LFARR and RTARR a left or a right INDENT by one space for a specified number
; of lines with the default being one line or the entire ATTACH buffer.
LFARR: MOVNI T,1
SKIPA
RTARR: MOVEI T,1
MOVEM T,INMAR
MOVEM T,TMPMAR
TLZ F,CEN!ALIN!JOINF
TLO F,INDEN
; PUSHJ P,LEFMAR
MOVEI T,=118
MOVEM T,JSIZE
MOVEM T,JSIZE2
TRNE F,ARG
JRST JUST2 ;The argument takes precedent.
TRNN F,ATTMOD ;Are we in ATTACH mode?
TRO F,ARG ;No, so set flag
JRST JUST2 ;Yes, so do entire ATTACH buffer.
JLEFT: SORRY XJLEFT has not been implemented.
POPJ P,
ALIGN:
ALINE: TRO F,NEG ;Want it treated as JFILL in JDUMP
TLZ F,CEN!INDEN!JOINF ;But not like CENTER or INDENT
TLO F,ALIN
PUSHJ P,LEFMAR
JRST JUST2 ;Get started as for JUST.
CENTER: TLZ F,INDEN!ALIN!JOINF
TLO F,CEN ;Set CENTER flag
TRO NEG ;To inhibit filling.
TRNE F,ARG
JRST JUST1 ;The argument takes precedent.
TRNN F,ATTMOD ;Are we in ATTACH mode?
TRO F,ARG ;No, so set flag
JRST JUST1 ;Yes, so do entire ATTACH buffer.
JOIN: TRO F,NEG
TLZ F,INDEN!CEN!ALIN
TLO F,JOINF
TRNE F,ARG
JRST JOIN2
TRNE F,ATTMOD
JRST JOIN2
MOVEI A,2 ;Default to 2 lines
TRO F,ARG
JOIN2: PUSHJ P,LEFMAR ;Used for right margin in this case.
JRST JUST2
;LEFMAR,SHIFTY
;To accept left margin or indent specification.
LEFMAR: PUSH P,A ;Needed later.
MOVE T,EXTPNT ;To read margin changing instructions.
MOVEM T,TYIPNT ;Set pointer.
HRLI C,(<MOVEI C,>)
MOVEM C,TYIINS
SETZB A,C
SETZM INMAR ;Use as a flag for INDENT negative case
LEMAR0: PUSHJ P,TYI ;Get first character if any.
JRST LEMAR2 ;We are to use default values.
CAIN C," "
JRST LEMAR0 ;Ignore an extra space in here.
CAIN C,"+"
JRST LEMAR0
MOVEI TT,3
CAIE C,"-"
JRST LEMAR1
SOS INMAR ;Used as flag for negative INMAR later.
JRST LEMAR0
LEMAR1: CAIG C,71
CAIGE C,60
JRST LEMAR2
IMULI A,12
ADDI A,-"0"(C)
CAILE A,=118 ;Allow only 118 characters because of line buffer.
MOVEI A,=118
PUSHJ P,TYI
JRST LEMAR2 ;We can only have one number anyway.
SOJG TT,LEMAR1
LEMAR2: TLNE F,JOINF
JRST LEMAR5
TLNE F,INDEN ;Differentiate between INDENT and others
JRST LEMAR3
SKIPN A ;Must be ALINE case.
MOVE A,AMARS ;Use sticky value if none given
MOVEM A,AMAR
CAIN B,3 ;Are we to change default value
MOVEM A,AMARS ;Yes.
JRST LEMAR4
LEMAR3: SKIPN A ;This is the INDENT case.
MOVE A,INMARS ;Use sticky value if none given
SKIPGE INMAR ;Test if negative intended
MOVNS A ;Yes.
MOVEM A,INMAR
CAIN B,3
MOVEM A,INMARS
LEMAR4: MOVEM A,TMPMAR ;Gets reset by JNOCR but it might be needed sooner.
MOVEI A,=118
MOVEM A,JSIZE
MOVEM A,JSIZE2# ;JSIZE gets wiped out some place so save again.
POP P,A
POPJ P,
LEMAR5: SKIPN A
MOVE A,RJMARS
CAILE A,=118
MOVEI A,=118 ;Set upper limit allowed.
MOVEM A,JSIZE
MOVEM A,JSIZE2
CAIN B,3
MOVEM A,RJMARS
MOVEI A,1
MOVEM A,TMPMAR
POP P,A
POPJ P,
;This routine tests all lines of text that are in the ATTACH buffer for
;the presence of a space or a TAB in the first chararacter as a prelude
;to the execution of left shift.
SHIFTY: HRRZ D,[ATTBUF] ;Needed for completion test.
MOVE T,(D) ;Get starting location
SHFTY1: MOVE A,[350700,,3(T)] ;Pointer to the first word of text
LDB C,A ;and the first character
CAIE C,40 ;Is it a space?
CAIN C,11 ;or maybe a TAB?
JRST .+2 ;Good!
JRST SHFTY2 ;Too bad, give message and return
CAIN D,(T) ;Are we through?
AOJA P,SHFTY3 ;Yes, so use second return
MOVE T,(T) ;Go to next line of text
JRST SHFTY1 ;and go on
SHFTY2: SORRY one line (at least) is as far as it can go.
SHFTY3: POPJ P,
;MACRO FREE STORAGE - MFSCLR,GETMFS,FREMFS
SMFS←300 ;Size in blocks of macro free storage.
MFSBS←←6 ;Size of blocks in macro free stg.
ARRAY MACFS[smfs*mfsbs] ;Free storage space for macros.
MFSCLR: MOVEI B,SMFS ;CONS up a macro free stg. list.
MOVEI C,MACFS+MFSBS-1
MOVEM C,MFSPNT# ;Ptrs. are to last word of block...
MFSCL1: ADDI C,MFSBS
MOVEM C,-MFSBS(C)
SOJG B,MFSCL1
MOVEI B,[0]
MOVEM B, -MFSBS(C) ;List ends with ptr. to 0.
POPJ P,
GETMFS: SKIPN A,@MFSPNT ;Get a block of macro free stg.
HALT ;None.
EXCH A,MFSPNT
PUSH P,A ;This is a ptr. to last word of block.
SUBI A,MFSBS-2 ;Set all words of block to -1.
HRLI A,-1(A)
SETOM -1(A)
BLT A,@(P)
POP P,A
SETZM (A) ;Make last word 0.
SUBI A,MFSBS-1 ;Get ptr. to first word.
POPJ P,
FREMFS: ADDI A,MFSBS-1 ;Return a block to the free list. (A should pt. to 1st wd.)
EXCH A,MFSPNT
MOVEM A,@MFSPNT
POPJ P,
;MACRO DEFINER INPUT WATCHERS - INCHWL,INCHSL,SNEAKW,INCHRS,etc.: MACTYI
MACTYI: MOVEM A,MACTMP#
SKIPE MXCTPT#
JRST MTYIX
MTYIDO: POP P,A
AOS (P)
XCT 40
SOS (P)
MTYIX2: PUSH P,A
MOVE A,@MACTMP
CAIN A,MESCPC
JFCL MESCP
SKIPN MDEFPT# ;Are we defining a macro ?
JRST POPAJ
DPB A,MDEFPT
ILDB A,MDEFPT
JUMPN A,POPAJ
PUSHJ P,GETMFS
HRRM A,@MDEFPT
TLO A,331100
MOVEM A,MDEFPT
JRST POPAJ
MTYIX: ILDB A,MXCTPT
JUMPN A,MTYIX1
ILDB A,MXCTPT
JUMPN A,@MTXDSP(A)
HRRZ A,@MXCTPT
TLO A,331100
MOVEM A,MXCTPT
JRST MTYIX
MTYIX1: EXCH A,(P)
POP P,@MACTMP
JRST MTYIX2
MTXDSP: ;PREVIOUSLY UNDEFINED
MESCPC: ;PREVIOUSLY UNDEFINED
MESCP: ;PREVIOUSLY UNDEFINED
;ZDATA,ZSIX,ZBLT,ZEDFIL,ZLIST,EXIST
COMMENT ⊗
ZDATA is used to hold records of data extracted from EDFIL when a file change
requested. The format of EDFIL, and hence of each record in ZDATA is as follows:
Word Contents
0 File name in SIXBIT
1 Extension in SIXBIT,,DATE INFORMATION
Bits 18-20 are the high order bits of the creation date
Bits 21-35 are used for the dump date.
2 Used by RENAME and ENTER
Bits 0-8 protection key
Byts 9-12 Mode field
Bits 13-23 time
Bits 24-35 low bits of the creation date
3 PPN in SIXBIT. This is overwritten in EDFIL by the LOOKUP routine.
4 Information that is in register D on entering BEG3 and put into SRCFIL
Flag information kept in left half
Flags Meaning other→ F-Flag Word flag
100000 /N no directory
Has complete directory DIROK←←4
Editing directory EDDIR←←100
200000 /R readonly REDNLY←←1 RDONLY
400000 creating CREASW
5 CURPAG (binary),,ARRL (binary)
Additional information in ZDATA that is not in EDFIL
6 to 13 SPAGE,SLINE,,SPAGE,SLINE (2 XMARK values in each of 8 words)
END OF COMMENT ⊗
IMPURE
ZNUM←←10 ;8 files.
ZENT←←16 ;14 entries per file.
ZSIZE←←160 ;ZNUM*ZENT
0
ZDATA: BLOCK 160 ;ZNUM*ZENT Space for file names and data
0
EZDATA←←.-2
ZINDEX: 0 ;Index to ZDATA as new name is typed.
ZOLDX: 0 ;Old INDEX saved for emergency return
ZDATAR: 0 ;Return reference index to ZDATA
ZDATAN: 0 ;Newly requested reference index to ZDATA
PURE
ZSAVE: MOVE T,ZDATAR
MOVEM T,ZDATAN ;Save to permit back-up if trouble
MOVE T,ZINDEX ;Get ready to save current file info.
MOVEM T,ZOLDX ;ZOLDX may be used to return if new file not found
TLO F,ZATT ;To preserve attach status
TRNN F,REDNLY ;Don't change home designation if read-only
MOVEM T,ZDATAR ;Save new home index
MOVE TT,ARRL
HRL TT,CURPAG
MOVEM TT,ZDATA+5(T) ;The rest of the data was saved at FRD time
;Now pack the marks two to the word and store them with rest of the data
ZPACK: MOVEI B,10 ;Storing 16 marks into 8 words
MOVE C,[POINT 18,MARKS,-1] ;From table MARKS (page,,line)
MOVEI G,4 ;4 bytes per word into TT
MOVE E,[POINT 9,TT,-1]
ILDB H,C
IDPB H,E
SOJG G,.-2
MOVEM TT,ZDATA+6(T)
ADDI T,1
SOJG B,.-7
;Packing complete
TRNN F,REDNLY
PUSHJ P,WRPAGE ;Save page if not in READONLY mode
CLOSE DSKO, ;Make sure file gets out safely
MOVE TT,['ET '] ;Distroy any reference to CE or CR
MOVEM TT,SYSCMD ;since file has been written
; PUSHJ P,TMPWRT ;We may want to return
PUSHJ P,FLSPAG ;This should flush page without bothering ATTACH buffer.
PUSHJ P,ZFLDIR ;Necessary to make room if repeated switching is allowed
SETZM DIRPT ;Directory has been fixed
SETZM DIRP1 ;Directory has been fixed
MOVEI TT,EDFIL+4
MOVEM TT,SRCFIL+4 ;To circumvent old monkey business
SETZM CREASW ;Don't want to be in CREATE mode for sure.
POPJ P,
;Now unpack the appropriate marks and restore them to the mark table
ZUNPAK: MOVEI B,10
MOVE C,[POINT 18,MARKS,-1] ;To table MARKS (page,,line)
MOVE TT,ZDATA+6(T)
MOVEI G,4 ;4 bytes per word from TT
MOVE E,[POINT 9,TT,-1]
ILDB H,E
CAIL H,777 ;May be void
MOVEI H,777777 ;It is. Note: marks on page or line 511 go away
IDPB H,C
SOJG G,.-4
ADDI T,1
SOJG B,.-11
POPJ P,
;ZLIST is called by FRDX and by QUERY and stores data in the form required by BEG3.
ZLIST:
ESSAY,< SKIPE ESEPSY ;IF A π COMMAND, DO SOMETHING DIFFERENT
JRST ESZLST>
PUSH P,T
PUSH P,TT
PUSH P,C
MOVEI T,0
ZLIST1: MOVE TT,ZDATA(T)
JUMPE TT,ZLIST3 ;Empty space found, so not in list.
CAME TT,EDFIL ;Check file name
JRST ZLIST2 ;Not this file
HLLZ TT,EDFIL+1
CAME TT,ZDATA+1(T) ;Check extension
JRST ZLIST2 ;Nope
MOVE TT,ZDATA+3(T) ;Check PPN
CAMN TT,EDFIL+3
JRST ZLIST3 ;This must be it
ZLIST2: ADDI T,ZENT ;Go to next entry
CAIGE T,ZSIZE-1 ;but is there one?
JRST ZLIST1 ;Go back and try again
OUTSTR [ASCIZ /
Out of table space, may last entry be overwritten? (Y or N) /]
PUSHJ P,YESCHK
JRST ZLIST3-1
OUTSTR [ASCIZ / Too bad!
Will overwrite the second file name then./]
MOVEI T,ZENT
SKIPA
SUBI T,ZENT ;Back up to overwrite
ZLIST3: MOVEM T,ZINDEX ;Save so CURPAG and ARRL can be added later.
MOVNI TT,4 ;Transfer complete EDFIL
HRLZS TT
ZLIST4: MOVE C,EDFIL(TT)
MOVEM C,ZDATA(T)
ADDI T,1
AOBJN TT,ZLIST4
MOVEM D,ZDATA(T)
SKIPG C,SLINE
MOVEI C,1 ;We want this to always be greater than 0
TLO C,1 ;Similarly with SPAGE
SKIPLE SPAGE
HRL C,SPAGE
MOVEM C,ZDATA+1(T) ;May be overwritten, but save just in case
POP P,C
POP P,TT
POP P,T
POPJ P,
ESSAY,<
ESZLST: PUSH P,T ↔ PUSH P,TT ↔ PUSH P,C ;NORMAL ZLIST CODE WANTS THESE ALL ON STACK
SETZM ESEPSY
MOVE T,ZINDEX
ADDI T,ZENT
CAIGE T,ZSIZE-1 ;SKIP IF OVERSHOT TOP
JRST ZLIST3 ;THIS WILL SAVE NEW T AND MUMBLE ON
OUTSTR [ASCIZ /
Warning -- Ran out of file stack space. Clobbering last entry./]
SUBI T,ZENT
JRST ZLIST3
>;ESSAY
;This routine shows all files that have been assigned numbers with CURPAG and ARRL.
;If called with a 0 argument it deletes all marks instead
;It is called by the command <CONTROL>∃ or by <CONTROL>0<CONTROL>∃
EXIST:
TRNE F,ARG
SKIPE A ;Zero argument request to flush
JRST EXIST0 ;Reporting, not flushing
;Zero argument case for flushing
TRZ F,ARG ;Safety precaution only
SKIPN T,ZINDEX ;Get present file index
JRST EXISTA ;It is already at 0
;First move the present file record
MOVSI A,ZDATA(T)
ADDI A,ZDATA
BLT A,ZDATA+ZENT ;Move current file listing to start at ZSDATA
;Now flush the rest
EXISTA: MOVEI T,ZENT
EXISTB: MOVEI TT,6 ;6 entries related to file designation
SETZM ZDATA(T) ;Set these to zero
ADDI T,1
SOJG TT,.-2
MOVEI TT,10 ;8 words devoted to marks
SETOM ZDATA(T) ;These must be set to -1
ADDI T,1
SOJG TT,.-2
CAIGE T,ZSIZE-1
JRST EXISTB
SETZM ZINDEX
SETZM ZDATAR
OUTSTR [ASCIZ /
Current file record shifted to 0, the rest have been flushed.
/]
AOS (P)
POPJ P,
;No argument case for reporting
EXIST0: MOVEI D,ZDATA
MOVEI E,0
OUTSTR [ASCIZ /
/]
SETZM TYOPNT
EXIST1: MOVE TT,0(D)
JUMPE TT,EXIST2
MOVE TT,E
IMULI TT,ZENT
CAME TT,ZDATAR
JRST .+3
TYPCHR "H"
SKIPA
TYPDEC E
CAME TT,ZINDEX
JRST .+3
TYPCHR "]" ;Mark current file differently for convenience
SKIPA
TYPCHR ")"
TYPCHR " "
PUSHJ P,FILST2
OUTSTR [ASCIZ / /]
HLRZ TT,5(D)
TYPDEC TT
TYPCHR "P"
HRRZ TT,5(D)
TYPDEC TT
TYPCHR "L"
OUTSTR [ASCIZ /. /]
ADDI E,1
TRNN E,3
TYPCHR "
"
ADDI D,ZENT
JRST EXIST1
EXIST2: AOS (P)
POPJ P,
;To free the directory space. FLSDIR does not seem to work with Z routines
ZFLDIR: SKIPN A,DIR
POPJ P,
MOVE C,PAGES
TLO F,NOCHK
CAIN A,DIREND
JRST .+5
HRRZ B,(A)
PUSHJ P,FSGIVE
SKIPE A,B
SOJG C,.-5
TLZ F,NOCHK
TRZ F,DIROK ;We don't want to fool anybody
MOVEI T,XDIRCH
MOVEM T,DIRSIZ
MOVEM T,DIROVH
SETZM DIR
POPJ P,
;LAMBDA,EPSIL,NWFILE,HOME,QUERY,HOMEG,LAMBDG
;LAMBDA (LOOK) opens a file in read-only mode but still allows one to enter or
;leave the file with text in the ATTACH buffer. Of course, attached text is not
;actually removed from the file unless one changes to read-write mode.
;It is called by the command <CONTROL>λ<FILE NAME> or if the file had been
;referenced earlier and assigned a number, say 2, by <CONTROL>2<CONTROL>λ
LAMBDG: SETOM ESEPSY ;MEANS WE GOT HERE BECAUSE OF αβπ COMMAND, DO DIFFRNT STUFF
SETZM ESCTLM
TRNN B,2
JRST EPSIL ;FOR CONTROL PI, ASK FOR FILE NAME, ETC. BUT DO ESEPSY PUSHJ
NOESS,< POPJ P, ;IGNORE αβπ UNLESS IN ESSAY>
SETOM ESCTLM ;FOR CONTROL META PI SET FLAG, DO READONLY
LAMBDA: PUSH P,A
PUSHJ P,ZSAVE ;Save a record of present conditions
MOVEM F,FOLD# ;Might be needed if command is aborted
TRO F,REDNLY ;Set for read only
SETOM RDONLY ;Set for read only
JRST EPSIL0
;EPSILON (ENTER) opens a file in read-write mode.
;It conforms in other respects to LAMBDA above.
EPSIL: PUSH P,A ;Save argument if there is one
PUSHJ P,ZSAVE ;Save a record of present conditions
MOVEM F,FOLD ;May be needed if command is aborted
TRZ F,REDNLY ;Set for READWRITE
SETZM RDONLY ;Set for read write
EPSIL0: TLO F,ZATT ;To preserve ATTACH status
SETZM DIR ;So that new directory will be created.
POP P,T ;Better to have argument in T
TRNN F,ARG
JRST EPSIL2
CAIL T,ZNUM
JRST EPSIL4
IMULI T,ZENT
MOVEM T,ZINDEX ;Save as index to get new file name etc.
EPSIL1: MOVE A,ZDATA(T) ;Get file name
JUMPN A,EPSIL3
EPSIL4: ESSAY,<SKIPN ESEPSY ;GIVE DIFFERENT MESSAGE FOR αβπ COMMAND>
OUTSTR [ASCIZ / Request aborted. One moment please.
/]
ESSAY,<SKIPE ESEPSY ;FOR αβπ USER, SAY
OUTSTR [ASCIZ / No suitable file pointer found.
/]
>;ESSAY
SETZM RDONLY
MOVE F,FOLD
TRNE F,REDNLY
SETOM RDONLY
MOVE T,ZDATAN
MOVEM T,ZDATAR ;Restore old HOME designation
MOVE T,ZOLDX
MOVEM T,ZINDEX ;Restore this also.
JRST EPSIL1 ;And go back to old file
EPSIL3: MOVEM A,EDFIL
HLLZ A,ZDATA+1(T) ;Get extension
MOVEM A, EDFIL+1
SETZM EDFIL+2
MOVE A,ZDATA+3(T) ;Get PPN
MOVEM A,EDFIL+3
SETZM EDFIL+4
MOVE D,ZDATA+4(T)
HLRZ B,ZDATA+5(T) ;Get CURPAG
MOVEM B,CURPAG
MOVEM B,SPAGE
HRRZ B,ZDATA+5(T) ;Get ARRL
MOVEM B,ARRL
MOVEM B,SLINE
PUSHJ P,ZUNPAK ;Unpack the line MARKS
; PTWR1W[0↔15] ;Send a cr to the line editor to clear for command
MOVEI C,15 ;BEG3 MAY EXPECT THIS
POP P,T ;Get rid of last return address
ANDI F,REDNLY!ATTMOD ;The only flags to be saved.
TLO F,ZATT ;But this needs resetting.
MOVEI T,EDFIL
MOVEM T,SRCFIL ;This may have been clobbered
MOVSI T,'DSK'
MOVEM T,EDFIL-1
JRST BEG3
EPSIL2: ;GET HERE WHEN ε OR λ GETS NO ARG, ASK FOR FILE NAME
POP P,T ;Get rid of last return address
SETZM SLINE
SETZM SPAGE
SETZM XXPAGE
SETZM XXLINE
SETZM MARKS
MOVE A,[MARKS,,MARKS+1]
BLT A,MARKS+NMARKS-1 ;Init. the marks array.
SKIPN ESEPSY ;SKIP IF αβπ COMMAND
JRST BEG0.1 ;NOPE, DO NORMAL αβε OR αβλ THING
SKIPN ESCTLM ;SKIP IF CONTROL META π; CTRLπ MEANS DON'T SCAN FILE FOR PTR
JRST .+4
PUSHJ P,PTRP ;RETURN POINTER TO LINE IN A, DIRECT IF PTRBIT IS ON
JRST ESSREA ;READ LINE, GO TO FILE
JRST ESSREA ;GO THERE IN ANY CASE, WE NOT USING PTRBIT ANYMORE
;< >;ESSAY
JRST BEG0.1 ;This starts new file OK, takes ATTACH buffer along
;but required a special flag to inhibit losing the
;the attachment.
NWFILE: OUTSTR [ASCIZ \
XNWFILE has been replaced by the ε and λ commands. See E.ALS[UP,DOC]/11P
You can switch to this now by typing <CONTROL>? and get back by <CONTROL>H
\]
AOS (P)
POPJ P,
;The H (HOME) command allows one to return to the last previous read-write file
;which is presumed to be the home file.
HOMEF: MOVE T,ZDATAR ;Get return index value
CAME T,ZINDEX ;Are we already home
JRST HOMEF1
OUTSTR[ASCIZ /
You are already HOME! /]
AOS (P)
POPJ P,
HOMEF1: PUSHJ P,ZSAVE ;Save a record of present conditions
MOVEM F,FOLD
MOVE T,ZDATAN
MOVEM T,ZINDEX ;Save just as in EPSIL0
TRZ F,REDNLY ;Set for READWRITE
SETZM RDONLY ;Set for read write
JRST EPSIL1 ;The rest of the routine is the same
HOMEG: PUSH P,A ;SAVE THE ARG OVER THIS RANDOM CALL
PUSHJ P,ZSAVE ;SAVE A RECORD OF PRESENT STATE
POP P,T
MOVEM F,FOLD
TRNN F,ARG ;IF WE GOT NO ARG
SKIPA T,[-ZENT] ;GO BACK 1 FILE IF NO ARG
IMUL T,[-ZENT]
ADD T,ZINDEX
CAIGE T, ;IF NEG, USR REALLY MEANT ZERO [BACKED OFF TO FAR
MOVEI T, ;THIS IS FOR YOUR OWN GOOD.
MOVEM T,ZINDEX ;SAVE NEW ZINDEX (FILE SHOULD LOOK AT)
JRST EPSIL1
;QUERY allows one to reference the file E.ALS[UP,DOC] to check on some feature
;of E without losing ones place in the file being edited.
QUERY: PUSHJ P,ZSAVE ;Save a record of present conditions
ANDI F,ATTMOD!REDNLY
TLO F,ZATT
TYPCHR " "
MOVEI T,0
MOVEI TT,[ASCIZ \E.ALS[UP,DOC]/1P/1L/R\]
PTWRS7 T ;This should put the string into the PTY buffer
MOVEI TT,15 ;We need a carriage return without a line feed
PTWR1W T ;Init. the marks array.
JRST BEG1
;********* BEG OF ESSAY DEFS *********
;ESSAY,<
DEFINE FOO (MSG) <
PUSHJ P,[
PUSH P,T
FOR ZZZ ε <MSG> <
IFN 12-"ZZZ",< ;FILTER OUT LFS
MOVEI T,"ZZZ"
IDPB T,ESILBP
>;IFN LINE FEED
>;FOR
POP P,T
POPJ P,
];PUSHJ
>;DEFINE FOO
DEFINE FOOC (MSG) <
PUSHJ P,[
PUSH P,T
FOR ZZZ ε <MSG> <
IFN 12-"ZZZ",< ;FILTER OUT LINE FEEDS
MOVEI T,"ZZZ"
IORI T,200
IDPB T,ESILBP
>;IFN LINE FEED
>;FOR
POP P,T
POPJ P,
];PUSHJ
>;DEFINE FOO
ESCOMT: MOVE T,[441100,,ESCMTX] ;POINTER TO AREA FOR COMMAND STRING TO BE PTWRS9d
MOVEM T,ESILBP
OUTSTR [ASCIZ /Moment please.../]
MOVEI T,615 ;<CTRL><META><RETURN>
IDPB T,ESILBP
FOO <(Comment here by >
GETPPN T,
LDB TT,[140600,,T] ;PICK UP THE FIRST CHARACTER OF PROGRAMMER NAME
CAIN TT, ;THERE ARE STILL A FEW BAG BITERS W 2 CHR PROGRAMMER NAMES
JRST ESCM1
ADDI TT,40
IDPB TT,ESILBP
ESCM1: LDB TT,[60600,,T] ;SECOND CHR
ADDI TT,40
IDPB TT,ESILBP
ANDI T,77 ;AND NOW FOR SOMETHING COMPLETELY DIFFERENT
ADDI T,40
IDPB T,ESILBP
FOO < is on page >
MOVE T,PAGES ;GET PAGE NUMBER OF LAST PAGE
ADDI T,1
PUSHJ P,ESDPT ;DECIMAL PRINT TO ESILBP
FOO <.)>
MOVEI T,215
IDPB T,ESILBP
FOOC <π> ;CONTROL RETURN AT END OF NEW COMMENT POINTER AND CTRL π FOR COMMENT PAGE PUSHJ
MOVE T,[440600,,EDFIL]
REPEAT 6,<ILDB TT,T ;CRANK OUT OUR FILE NAME
ADDI TT,40
CAIE TT,40
IDPB TT,ESILBP>
MOVEI TT,"."
IDPB TT,ESILBP
REPEAT 3,<ILDB TT,T ;EXT
ADDI TT,40
CAIE TT,40
IDPB TT,ESILBP>
MOVEI T,"[" ;PPN
IDPB T,ESILBP
MOVE T,[440600,,EDFIL+3]
REPEAT 3,<ILDB TT,T
ADDI TT,40
CAIE TT,40
IDPB TT,ESILBP>
MOVEI TT,","
IDPB TT,ESILBP
REPEAT 3,<ILDB TT,T
ADDI TT,40
CAIE TT,40
IDPB TT,ESILBP>
FOO <](>
MOVE T,PAGES ;AND LAST PAGE NUMBER OF FILE
PUSHJ P,ESDPT
FOO <P)>
MOVEI T,15
IDPB T,ESILBP
FOOC <∞WX>
FOO <M>
MOVEI T,15 ↔ IDPB T,ESILBP
FOOC <V>
SKIPE ESCMTZ ;WORD AFTER ESCMTX BLOCK. SHOULD NOT HAVE BEEN WRITTEN INTO
FATAL Bug 69 in Essay comment code.
PUSHJ P,READWR ;WANT TO BE IN READW MODE
DPYPOS -1020 ;POSITION OFF THE SCREEN SO USER DOESNT HAVE TO SEE TRASH
MOVEI T, ;OUTPUT NULL SO PTW WILL KNOW WHERE TO STOP
IDPB T,ESILBP
;ESGK: PUSHJ P,ESDBG ;DEBUG FEATURE
DPYPOS -1500 ;OFF END SO USER DONT HAVE TO SEE WHAT GOING ON
PTWRS9 [0↔ESCMTX]
SETOM ESCGIS# ;SET FLAG TO GET αβV COMMAND TO TYPE INSTRUCTIONS FOR USER
AOS (P)
POPJ P,
COMMENT ⊗
ESDBG: MOVE T,[441100,,ESCMTX]
DPYSIZ 30001
DPYPOS 1
ESDBG1: ILDB TT,T ;GET 9 BIT BYTE
JUMPE TT,[INCHRW TT ↔ POPJ P,]
TRZE TT,200 ;CONTROL BIT?
OUTSTR [ASCIZ /<CTRL>/]
TRZE TT,400 ;META BIT?
OUTSTR [ASCIZ /<META>/]
CAIN TT,15 ;CR
JRST [OUTSTR [ASCIZ /<CR>/] ↔ JRST ESDBG1]
CAIN TT,12 ;LF
JRST [OUTSTR [ASCIZ /<LF>/] ↔ JRST ESDBG1]
CAIN TT,11
JRST [OUTSTR [ASCIZ /<TAB>/] ↔ JRST ESDBG1]
OUTCHR TT
JRST ESDBG1
⊗;COMMENT
ESDPT: PUSH P,T
PUSH P,TT
PUSHJ P,ESDPT1
POP P,TT
POP P,T
POPJ P,
ESDPT1: IDIVI T,=10
HRLM TT,(P)
SKIPE T
PUSHJ P,ESDPT1
LDB TT,[220600,,(P)]
TRC TT,=48
IDPB TT,ESILBP
POPJ P,
ESINIT: ;INIT ESSAY VARS, ETC.
PUSHJ P,READONLY ;DEFAULT TO READONLY ALWAYS IN ESSAY. LATER THIS
;WILL HAVE TO CHECK THE STARTUP AND ESSAY SWITCH
POPJ P,
ESSREA: ;LOOK FOR A FILE NAME IN THE NEXT LINES OF TEXT, AND GO TO IT
MOVEI D,.ILDB ;INITIALIZE JSP AC FOR READING TEXT
MOVEM A,ESSBOS ;SAVE PTR TO CURRENT LINE FOR LOOKING FOR
ESRE1: JSP D,(D) ;PICK UP A CHR FROM LINE
JRST ESREFF ;END OF PAGE, FAILED TO FIND A SUITABLE FILE
CAIE A,"[" ;WE ARE LOOKING FOR WHAT COULD BE MIDDLE OF FILE NAME
JRST ESRE1 ;LOSE, TRY AGAIN
MOVEI B,"," ;SKIP RETURN IF THERE ARE 1-3 A-Z,a-z,0-9 CHARACTERS IN A
PUSHJ P,ESR3CH ;ROW, BROKEN WITH A COMMA
JRST ESRE1 ;LOSE, THIS GUY DOESN'T QUALIFY AS A PPN
MOVEI B,"]" ;SKIP RETURN IF YOU FIND ANOTHER 1-3 BROKEN BY CLOSE SQUARE
PUSHJ P,ESR3CH ;THE OTHER 1-3?
JRST ESRE1 ;CLOSE CALL...
PUSHJ P,ESBAKB ;BACK OVER THE FILE NAME
PUSHJ P,ESREC ;GIVE THIS FILE NAME ETC. TO TTY
FATAL <Internal confusion. Can't understand pointer>
PUSHJ P,RSCAN ;MAKE EVERYTHING READY FOR READING INSERTED FILE NAME
JRST BEG1 ;AND DON'T ASK FOR FILE NAME ON P OF PAPER
ESCCR: ;GOT A '(Comment h' at beg of line. COMMENT POINTER
CAIE A,"(" ;DOUBLE CHECK
FATAL INTERNAL CONFUSION -- COMMENT POINTER WENT AWAY
FOR ZZZ ε <Comment here by ∀∀∀ is on page > <
JSP D,(D) ;GET THE CHARACTER
FATAL PREMATURE END OF COMMENT POINTER
IFN "ZZZ"-"∀",< ;CHECK THE CHARACTER AGAINST STRING EXCEPT FOR ∀'S
CAIE A,"ZZZ"
FATAL CONFUSION WHILE READING COMMENT POINTER. PLEASE REPORT TO SGK
>;IFN
>;FOR
MOVEI T,
ESCCR1: ;Have just found reasonable comment pointer. Read a page number terminated
;by a period.
JSP D,(D) ;GET A CHARACTER
FATAL PREMATURE END OF COMMENT POINTER LINE WHILE READING PAGE NUMBER.
CAIN A,"." ;PERIOD MEANS END OF PAGE NUMBER
JRST ESCCR2 ;NOW GO THERE
IMULI T,=10
ADDI T,-"0"(A)
JRST ESCCR1
ESCCR2: MOVEM T,ESCCRT# ;HOLD ONTO PAGE NUMBER TO BE USED
MOVE T,[441100,,ESCMTX] ;SET UP BYTE POINTER FOR FILE SWITCHING COMMAND
MOVEM T,ESILBP
MOVE T,[440600,,EDFIL]
REPEAT 6,<;CRANK OUT OUR F FILE NAME
ILDB A,T
ADDI A,40
CAIE A,40
IDPB A,ESILBP
>;REPEAT
FOO <.> ;PUNCTUATION BETWEEN FIRST FILE NAME AND EXT
REPEAT 3,<;CRANK OUT OUR EXT
ILDB A,T
ADDI A,40
CAIE A,40
IDPB A,ESILBP
>;REPEAT
FOO <[> ;BEGIN PPN
MOVE T,[440600,,EDFIL+3]
REPEAT 3,<;CRANK OUT F HALF OF PPN
ILDB A,T
ADDI A,40
CAIE A,40
IDPB A,ESILBP
>;REPEAT
FOO <,>
REPEAT 3,<;CRANK OUT 2 HALF OF PPN
ILDB A,T
ADDI A,40
CAIE A,40
IDPB A,ESILBP
>;REPEAT
FOO <](> ;CLOSE PPN, BEGIN SWITCHS (FOR PAGE NUMBER)
MOVE T,ESCCRT ;GET PAGE NUMBER
PUSHJ P,ESDPT
FOO <P)
>; IS "(69P)"<CR>
MOVEI T, ;OUTPUT NULL SO PTW WILL KNOW WHERE TO STOP
IDPB T,ESILBP
PTJOBX [0↔3]
PTWRS9 [0↔ESCMTX]
PTJOBX [0↔4]
PUSHJ P,RSCAN
JRST BEG1
PURGE FOO,FOOC
ESBAKB: ;BACK UP OVER THE FILE NAME
MOVE A,ESILBP ;GET THE BYTE POINTER WE WILL BE BACKING UP
ESBKB1: ADD A,[70000,,] ;GO ON TO THE PREVIOUS BYTE
CAIG A, ;DIRECT IF WE ARE READY TO MOVE ON TO PREVIOUS WORD
SUB A,[430000,,1];MAKE IT 010700,,<PREVIOUS WORD TO ONE WE WERE READING FROM>
CAMN A,ESOLBP ;DIRECT IF WE HAVE BACKED THE BYPE POINTER INTO BEGINING OF THIS LINE
;ESOLBP HAS THE BYTE POINTER FOR BEG OF LINE AS CONSd UP BY .ILDB
JRST ESBKBE ;WE MUST BE THERE
LDB B,A ;GET THE CHARACTER
CAIE B," " ;SPACE
CAIN B,11 ;TAB
JRST ESBKBE ;BREAK ON
JRST ESBKB1 ;SOME MORE
ESBKBE: MOVEM A,ESILBP ;SAVE THIS AS CURRENT BYTE POITER
POPJ P,
ESREFF: JRST EPSIL4 ;FOR NOW ;COULDN'T FIND A FILE NAME ON THIS PAGE
ESR3CH: ;SKIP RETURN IF THERE ARE 1 THRU 3 CHRS A-Z,a-z 0-9 STRAIGHT BROKEN BY (B)
REPEAT 3,<
JSP D,(D) ;CHR
POPJ P,
CAIN A,(B) ;THE ONLY WEIRD CHARACTER ALLOWED, CALLER SUPPLIED
JRST ESR3C1 ;DUN
CAIGE A,"0" ;IF YOU ARE BEHIND 0 YOU LOSE FOR SURE
POPJ P,
CAIL A,":" ;IF BETWEEN : AND @ YOU LOSE
CAILE A,"@"
CAIA ;CHARACTER WINS
POPJ P, ;CHARACTER LOSES
CAIL A,"[" ;IF BETWEEN [ AND ` YOU LOSE
CAILE A,"a"-1;NOT SURE OF KEYBOARD CHR JUST BEFORE a
CAIA
POPJ P,
CAILE A,"z" ;DIRECT IF AFTER z.
POPJ P,
>;REPEAT 3
JSP D,(D) ;NOW THAT WE HAVE HAD 3 REAL CHRS, MUST FIND A 'WEIRD' CHR
POPJ P, ;NO MORE PAGE
CAIE A,(B)
POPJ P,
ESR3C1: AOS (P) ;IF YOU GOT THIS FAR YOU DESERVE TO SKIP
POPJ P,
.ILDB: PUSH P,B ↔ PUSH P,C
MOVE A,ESSBOS ;GET THE PTR TO VERY LINE USER POINTING AT, IS 1ST
MOVEM A,ESILBS ;PTR TO THE BEG OF LINE TO READ FROM
.ILDB0: MOVE A,ESILBS ;GET ADDRESS OF FIRST WORD OF LINE'S BLOCK
LDB B,[111100,,1(A)] ;THE THIRD WORD OF THIS LINE'S BLOCK SEZ # OF CHRS
MOVEM B,ESILRC ;SOSGE COUNTER OF N CHRS FOLLOWING BYTE PTR GOOD FOR
ADD A,[10700,,2] ;FOURTH WORD OF BLOCK IS TEXT, MAKE A BYTE PTR OF ADDRS
MOVEM A,ESILBP
MOVEM A,ESOLBP ;THIS ONLY GETS CLOBBERED HERE. SO ESBAKB KNOWS WHERE BEG OF LINE IS
MOVE B,1(A) ↔ CAMN B,["(Comm"⊗1+1] ↔ JRST [MOVE B,2(A) ↔ CAMN B,["ent h"⊗1+1]
MOVEI D,ESCCR-1 ↔ JRST .+1 ]
.ILDB1: SOSGE ESILRC ;SKIP IF THERE ARE ANY CHRS LEFT TO READ HERE
JRST .ILD1 ;THIS LINE RAN OUT, GO GET A NEW ONE
ILDB A,ESILBP
POP P,C ↔ POP P,B
JSP D,1(D) ;SKIP RETURN
PUSH P,B ↔ PUSH P,C
JRST .ILDB1 ;WHEN HE ASKES FOR NEXT CHR, GO THRU THIS AGAIN
.ILD1: ;CHRS IN THIS LINE RAN OUT, CHECK OUT NEXT LINE
MOVE A,ESILBS ;GET THE ADDRESS OF LINE THAT JUST EXPIRED
HRRZ A,(A) ;GET SECOND WORD OF THIS BLOCK, WHICH PTS TO NEXT
CAIN A,BOTSTR ;IF IT POINTS TO BOTSTR, NO MORE LINES IN PAGE
JRST .ILDNC ;NO MORE CHARACTERS, DIRECT RETURN. SUBSEQUENT CALLS DIRECT RETURN
MOVEM A,ESILBS ;SAVE POINTER TO THIS NEW LINE
MOVE B,(A) ;NOW GET FIRST WORD OF NEW LINE TO SEE IF IT IS COMMENT
CAMN B,["(Comm"⊗1+1]
JRST [ MOVE B,1(A) ;WIN. SEE IF NEXT WORD MAKES IT TOO
CAMN B,["ent h"⊗1+1]
MOVEI D,ESCCR+1 ;MUNG THIS SO WE WILL RETURN TO COMMENT HACKER
JRST .+1 ;OH WELL
]
JRST .ILDB0 ;NOW MAKE UP BYTE POINTER, CHARACTER COUNT, AND DO IT
.ILDNC: POP P,C
POP P,B
JSP D,(D) ;DIRECT RETURN INDICATING NO MORE CHARACTERS
JRST .-1 ;FOR SUBSEQUENT CALLS UNTIL .ILDB SUBR RESET.
;ALLOWS END OF PAGE INFORAMATION TO PROPAGATE UP PDL, SORT OF
IMPURE
ESEPSY: 0 ;ZERO EXCEPT WHEN EPSIL STUFF IS DOING AN ESSAY STYLE HACK
ESCTLM: 0 ;-1 WHEN CTL META π, 0 FOR CTL π MEANING
;SERACH FOR TEXT PTR, AND ONLY READ KEYBOARD RESPECTIVELY
ESILRC: 0 ;.ILDB KEEPS # CHRS LEFT IN THIS LINE HERE
ESILBP: 0 ;KEEP BYTE PTR HERE WHILE IN A LINE, COMMENT CODE ALSO USES
ESOLBP: 0 ;PUT EACH NEWLY CONSd UP ESILBP HERE FOR ESBAKB
ESILBS: 0 ;POINTER TO LINE .ILDB IS READ HERE
ESCMTX: BLOCK =40 ;HOLDS COMMAND STRING TO BE PUT IN INPUT BUFFER
;FOR COMMENT (αβ∀) COMMAND
ESCMTZ: 0 ;IF THIS IS NON 0 SOMETHING IS WRONG
PURE
ESREC: ;COPY TO TTY FROM ESILBP. DIRECT RETURN ON NULL, SKIP RETURN ON
;SPACE OR CR. APPEND CR FOR SPACE OR CR. AFTER ] IS SEEN, FILTER . AND ,
PUSH P,A ↔ PUSH P,B ↔ PUSH P,C
MOVEI A,
MOVEI B, ;ZERO LINE NUMBER IS US
ESRE1A: ILDB C,ESILBP ;GET A CHARACTER
JUMPE C,ESRE1B ;SKIP RETURN ON NULL
TRNN A,1 ;SKIP IF A ] HAS BEEN PROCESSED
JRST ESRE1C ;CONTINUE IN NORMAL MODE
CAIE C,"." ;REMOVE THESE AFTER A ] HAS BEEN SEEN
CAIN C,"," ;E.G. "... IN FOO.BAR[105,SGK]/69P, OR ABC.DOC[UP,DOC]."
JRST ESRE1A ;JUST INGORE THESE CHARACTERS
ESRE1C: CAIN C,"]" ;AFTER THIS HAS BEEN SEEN, FILTER OUT , AND .'S
TRO A,1 ;FLAG
CAIE C,15 ;SKIP RETURN ON CR OR SPACE DELIMTER. SEND CR BEFORE RETURN
CAIN C," "
JRST ESRE1B
PTWR1S B ;SEND THE CHARACTER
FATAL <Bug 69 in Essay code>
JRST ESRE1A ;MORE
ESRE1B: MOVEI C,15 ;SEND A CR
PTWR1S B
FATAL <Bug 69 in Essay code>
AOS -3(P) ;SKIP RETURN
CPOPJ3: POP P,C
POP P,B
POP P,A
POPJ P,
PTRP: ;SKIP RETURN IF PTRBIT IS OFF FOR ARRL, ALWAYS RETURN ADDRESS OF BLOCK IN A
MOVEI A,PAGE ;INITIALIZE LOOP RUNNING THRU LINES FOR ARRL
MOVE T,ARRL ;LOOP COUNT, WANT ARRL LINE'S BITS
PTRP1: HRRZ A,(A) ;GET POINTER TO NEXT LINE RECORD FROM SECOND WORD
SOJG T,PTRP1 ;LOOP COUNT
;A NOW POINTS AT THE CURRENT LINE
MOVE T,2(A) ;GET THE BITS FROM THIRD WORD OF BLOCK
TLNN T,PTRBIT ;SKIP IF THIS IS A REFERENCE LINE
AOS (P) ;SKIP RETURN, NOT A REFERENCE
POPJ P,
IMPURE
ESSBOS: 0 ;PTR TO CURRENT LINE GET STUCK HERE WHEN LOOKING FOR FILENAME
ESARRL: 0 ;GETS POINTER TO LINE REFERENCE FOUND IN
PURE
;>;IFN ESSAY
;SUBSTR
SUBSTR:
MOVEI A,1
MOVEM A,JCNT ;Probably not needed
MOVE D,ARRLIN
HRRZM D,JPTR# ;Location of source line of text in JPTR.
HLRZ A,(D) ;Left half of (D) into right half of A
HRLZM A,JLPT# ; and then into left half of JLPT.
MOVE E,SAVEE ;This may have been changed
SETZB B,G
MOVE A,ARRLIN ;Set by SETARR to line for action
SUBST0: MOVE D,1(A)
MOVEM D,SUBTMP#
ADD A,[440700,,LLDESC] ;Location where text starts
MOVE D,[440700,,BUF]
MOVEM D,JWPT ;Buffer pointer at start
MOVEI Q,SUBBUF(E) ;Substitution text location
ADD Q,[440700,,0]
SETOM BUF
MOVE T,[BUF,,BUF+1]
BLT T,BUF+37 ;Set up buffer properly
MOVE B,[-167,,0] ;Allow one space less than Line-Buffer size
HRRZ T,SRCOFF ;Character position to start deletion
JUMPE T,SUBST1 ;Substitution starts with the first character
ILDB C,A
IDPB C,D ;Copy text to deletion point
CAIN C,11
PUSHJ P,SUBTAB ;We must do this to get G and B set right
AOBJP B,.+1 ;Do not warn of overflow yet
SOJG T,.-5
SUBST1: HLRZ T,SUBSIZ(E) ;Get count of text to delete
ILDB C,A ;Index over replaced text
CAIN C,11 ;TABs require special treatment
PUSHJ P,EATTAB
SOJG T,.-3 ;Count deletions
HRRZ T,SUBSIZ(E) ;Length of substitution string is here
JUMPE T,SUBST3 ;The null substitution case
SUBST2: ILDB C,Q
IDPB C,D
CAIN C,11
PUSHJ P,FIXTAB ;Must fix TAB representation
AOBJP B,SUBOV1 ;Now warn that substitution itself is beyond buffer
SOJG T,SUBST2 ;Count insertions
SUBST3: ILDB C,A ;Get rest of original text
IDPB C,D
CAIN C,15 ;Watch for the CR
JRST SUBST4
CAIN C,11
PUSHJ P, SUBTAB ;Again do proper thing for TABs
AOBJN B,SUBST3
JRST SUBST3 ;Go on anyway, test comes later
EATTAB: ILDB C,A ;Eat all blanks to the next TAB
CAIE C,11
JRST .-2
POPJ P,
;This routine eats old spaces associated with tabs and puts in the correct number.
;It also keeps the correct records in G and B.
SUBTAB: ILDB C,A
CAIE C,11 ;First eat all old spaces
JRST .-2
FIXTAB: ADDI G,(B)
HRLI B,(B)
TLO B,-10
MOVEI TT,40
IDPB TT,D ;Insert correct number of spaces
AOBJN B,.-1
SUBI G,-1(B)
IDPB C,D ;Deposit terminating TAB
HRLI B,(B)
ADD B,[-167,,0] ;Restore safe count in left half
AOS (P) ;Skip return as we have already updated B enough
POPJ P,
SUBST4: MOVEI C,12
IDPB C,D
TDZA C,C ;Set C to zero and skip
IDPB C,D
TLNE D,760000
JRST .-2 ;Pad out with nulls
JUMPLE B,QFAST1
SUBOVE: SETZM TYOPNT
OUTSTR [ASCIZ /
Line /]
TYPDEC ARRL
OUTSTR [ASCIZ / on page /]
TYPDEC CURPAG
OUTSTR [ASCIZ / is too long for the LINE-EDITOR buffer.
Do you want to make substitution anyway? (type Y or N) /]
PUSHJ P,YESCHK
JRST QFAST1 ;Go ahead
JRST SUBOV3
;Now we must give up the space originally used by the line
QFAST1: MOVE A,JPTR ;Location of line
LDB T,[111100,,1(A)] ;Get 2nd 9 bits from right of 1(A)
MOVNI T,(T) ;and do 1's complement of T
ADDM T,CHARS ;add this to # in CHARS or ATTSIZ.
HRRZ C,(A) ;Get line forward pointer
MOVEM C,JPTR ;and put it in JPTR.
MOVSI T,JPTR ;with JPTR location in left half
HLLM T,(C) ;of pointer for line pointed to.
PUSHJ P,FSGIVE ;Give up storage space.
;Then we create a new line with proper pointers
QFAST2: ADDI G,2(B) ;Allow for CR and LF in G count
ADDM G,CHARS ;Previously debited by the number in original line
LSH G,11 ;Move G to byte position.
IORI G,(B) ;IOR in the actual char count.
MOVEI B,-BUF+1+LLDESC(D) ;Number of words.
PUSHJ P,FSGET ;Get space to store line.
MOVSI TT,BUF ;Starting location of source
HRRI TT,LLDESC(A) ;and starting location of destination.
BLT TT,-2(T) ;and now BLT, ending at location -2(T)
MOVSI T,TXTCOD ;A fancy way to store 2 in left half!
HLLM T,-1(A)
MOVE T,SUBTMP
HLLZM T,1(A) ;Replace old flags in left half
HRRM G,1(A) ;Char. cnts in right of 3rd header word.
AOS T,TXTNUM
MOVEM T,2(A) ;To 4th header word.
HLRZ T,JLPT
JFCL
CAIE T,PAGE
SKIPGE 1(T)
TRO F,UPDTXT ;Flag change in first line.
JFCL
QFAST8: TRO F,WRITE
HRLM T,(A)
HRRM A,(T)
MOVE TT, ARRLIN
CAMN TT,WINLIN
HRRZM A,WINLIN
HRRZM A,ARRLIN
HRLM A,(C)
HRRM C,(A)
HRRZ TT,2(A)
MOVEM TT,SRCNUM ;This will have been changed
QFAST6: PUSHJ P,SETWRT ;May need attention
HRRZ TT,SUBSIZ(E)
ADD TT,SRCOFF
SUBI TT,1
HRRZM TT,SRCOFF ;Move to last character of substitution
;Update count and test for continuance
MOVE TT,QCHR
AOBJP TT,QFAST4
MOVEM TT,QCHR
MOVEM TT,SUBFLG(E)
QFAST7: TRZ F,ARG!REL
TLZ F,OKF
CAIN E,FNDBUF
JRST FINBSL ;Go to the X routine
CAIN E,FNDTBF
JRST FNDBSL ;Go to the page-only routine
OUTSTR [ASCIZ /
Report bug to ALS/]
JRST SUBERR
QFAST4: JUMPE TT,QFAST5
CAIGE TT,144
JRST QFAST9
OUTSTR [ASCIZ /
100 substitutions have been made. Do you want to STOP? (type Y or N)
/]
PUSHJ P,YESCHK
JRST QFAST9
MOVE TT,[-144,,1]
ADDM TT,QCHR
ADDM TT,SUBFLG(E)
JRST QFAST7
QFAST9: OUTSTR [ASCIZ /
As requested, /]
AOS SUBFLG(E)
JRST SUBSTP ;To report on actual number replaced
QFAST5: MOVEM TT,QCHR ;To stop after 1 substitution
PUSHJ P,SUBSAY
; JRST DRAW ;Draw screen and stop
TLZ F,OKF
AOS(P)
POPJ P,
SUBSAY: OUTSTR [ASCIZ /
You have replaced \/]
MOVE E,SAVEE
MOVE A,[POINT 7,SRCBUF(E)]
ILDB TT,A
JUMPE TT,.+3
OUTCHR TT
JRST .-3
OUTSTR [ASCIZ /\ with \/]
MOVE A,[POINT 7,SUBBUF(E)]
ILDB TT,A
JUMPE TT,.+3
OUTCHR TT
JRST .-3
OUTSTR [ASCIZ /\
/]
POPJ P,
SUBOV1: SOJLE T,SUBST3 ;Came to end just in time
OUTSTR [ASCIZ /
Substitution string itself on page /]
SETZM TYOPNT
TYPDEC CURPAG
OUTSTR [ASCIZ / line /]
TYPDEC ARRL
OUTSTR [ASCIZ / will overflow LINE-BUFFER.
Do you want to make substitution anyway? (type Y or N) /]
PUSHJ P,YESCHK
JRST SUBOV2 ;Go ahead
SUBOV3: MOVE TT,QCHR
CAML TT,[-2,,-1]
JRST SUBOV0
OUTSTR[ASCIZ /
Do you want to skip this line only and continue? (type Y or N) /]
PUSHJ P,YESCHK
JRST QFAST7 ;Skip replacement and do not count
SUBOV0: OUTSTR [ASCIZ /
Substitution aborted.
/]
SETZM QCHR
TLZ F,OKF
AOS (P)
POPJ P,
JRST SUBSTP
SUBOV2: SUB B,[50,,0]
JRST SUBST2 ;Continue with insertion for ≤40 more characters
OUTDAT: OUTSTR [ASCIZ /
ARRL /]
SETZM TYOPNT
TYPOCT ARRL
OUTSTR [ASCIZ / A /]
TYPOCT A
OUTSTR [ASCIZ / B /]
TYPOCT B
OUTSTR [ASCIZ / C /]
TYPOCT C
OUTSTR [ASCIZ / D /]
TYPOCT D
OUTSTR [ASCIZ / F /]
TYPOCT F
OUTSTR [ASCIZ / SDSP /]
TYPOCT SDSP
OUTSTR [ASCIZ / QCHR /]
TYPOCT QCHR
OUTSTR [ASCIZ / P /]
TYPOCT P
OUTSTR [ASCIZ / PDL /]
TYPOCT PDL
JFCL
JFCL
JFCL
JFCL
JFCL
JFCL
POPJ P,
;SPOOLC
IMPURE
SPOOLD: BLOCK 21
PURE
XSPOOL: SETOM XGPFLG ;ENTER HERE FOR XSPOOL
JRST .+2
SPOOLC: SETZM XGPFLG ;ENTER HERE FOR LPT SPOOL
MOVE T,EDFIL
MOVEM T,SPOOLD+7 ;Start with first cha. of real name
MOVE T,CURPAG
MOVE A,[POINT 6,SPOOLD+7,5] ;Use 1 character of name
PUSHJ P,NUMSIX ;Add the page number
MOVEI TT,'$'
SKIPA
IDPB TT,A
TLNE A,760000
JRST .-2 ;Fill out with '$' characters
MOVE TT,20 ;Limit times to try
SPOOLL: MOVEI T,'LPT'
HRLZM T,SPOOLD+10 ;Six-bit file extension of source
SETZM SPOOLD+11
MOVE T,['SPLSYS']
MOVEM T,SPOOLD+12 ;Six-bit PPN of file
MOVE T,EDFIL
MOVEM T,SPOOLD+13 ;Alias name in six-bit
MOVE T,EDFIL+1
MOVEM T,SPOOLD+14 ;Alias extension in six-bit
MOVE T,EDFIL+3
MOVEM T,SPOOLD+15 ;Alias PPN in six-bit
MOVE T,CURPAG
HRLM T,SPOOLD+16 ;Page number in left half
MOVEI T,21
HRRM T,SPOOLD+16 ;Flags to print headings and delete file
SETZM SPOOLD+17
SETZM SPOOLD+20
OPEN DSKSP,[17↔'DSK '↔0]
JRST 4,.
LOOKUP DSKSP,SPOOLD+7
JRST SPOOLW ;Safe to use this name
CLOSE DSKSP,
MOVEI T,1
ADDM T,SPOOLD+7
SOJG TT,SPOOLL
SPOOLE: OUTSTR [ASCIZ /
Something is wrong with the spooler. Try again later.
/]
AOS (P)
POPJ P,
SPOOLW: ENTER DSKSP,SPOOLD+7
JRST SPOOLE
SETZM OBLK
PUSHJ P,XWRBF2 ;To set up 0CNT and 0PNT for first load
MOVE T,[OBUF-1,,OBUF]
BLT T,OBUF+177 ;Clear buffer
MOVEI A,PAGE
MOVEI DSP,XWRDSP
MOVSI E,LSPC+NSPEC
MOVE G,OPNT
MOVN B,OCNT
MOVSI B,(B)
XWRP1:
XWRLIN: HRRZ A,(A)
CAIN A,BOTSTR
JRST XWRDON
SKIPGE T,1(A)
JRST XWRPM
MOVEI D,LLDESC(A)
TRNN T,777
TLOA D,350700
HRLI D,440700
HRRI B,
XWRLUP: ILDB C,D
TDNE E,CTAB(C)
XCT @CTAB(C)
IDPB C,G
XWRLP2: AOBJN B,XWRLUP
PUSHJ P,XWRBUF
MOVE G,OPNT
MOVN T,OCNT
HRLI B,(T)
JRST XWRLUP
XWRDSP: JRST XWRLIN
JRST 4,.
JFCL
MOVEI D, ;KILL NEXT ILDB
JRST XWRTAB
JRST 4,.
JRST 4,.
XWRTAB: IDPB C,G
HRROI C,-10
IORI C,(B)
SUB B,C
ADD D,BTAB2+10(C)
JUMPGE D,.+2
ADD D,[XOR 1]
SOJA B,XWRLP2
XCLOSO: MOVE D,OPNT
CAMN D,[700,,OBUF-1]
POPJ P,
TDZA T,T
IDPB T,D
TLNE D,760000
JRST .-2
HRLI D,1(D)
ADDI D,2
CAMG D,[OBUF+177,,OBUF+200]
SETZM -1(D)
CAMGE D,[OBUF+177,,OBUF+200]
BLT D,OBUF+177
XWRBUF: OUT DSKSP,[-200,,OBUF-1↔0]
XWRBF1: AOSA OBLK
JRST 4,.
XWRBF2: PUSH P,T
MOVEI T,200*5
MOVEM T,OCNT#
MOVE T,[700,,OBUF-1]
MOVEM T,OPNT#
MOVE T,[OBUF-1,,OBUF]
TLNE F,CLRBF
BLT T,OBUF+177
POP P,T
POPJ P,
XWRDON:
MOVEM G,OPNT
PUSHJ P,XCLOSO
CLOSE DSKSP,
MOVE T,['SPLSYS'] ;This will have been clobbered
MOVEM T,SPOOLD+12 ;Six-bit PPN of file
JRST SPALL ;CALL GORIN - ARGUMENTS IN SPOOLD
XWRPM: HRRZ B,-1(P)
MOVN T,1(B)
PUSHJ P,WRCHK
LDB C,[341000,,LLDESC+LPMTXT+1(A)]
IMULI C,200*5
LDB E,[221200,,LLDESC+LPMTXT+1(A)]
ADDI C,(E)
CAIE T,(C)
JRST 4,.
MOVEM G,OPNT
PUSHJ P,XCLOSO
MOVE T,-1(P)
HRRZ T,(T)
MOVE C,OBLK
CAME C,1(T)
JRST 4,.
MOVEM T,-1(P)
MOVE G,OPNT
MOVN B,OCNT
MOVSI B,(B)
MOVSI E,LSPC+NSPEC
JRST XWRP1
BEGIN SPSUB
GLOBAL DSKSP,P,F,A,B,C,D,%SEG
PDLEN←←20
IMPURE
SPRUNB: ;NEXT THREE ARE NAME, PPN AND ZERO
SPLNAM: SIXBIT /[LIST]/ ;SPOOLER'S NAME
SPLPPN: SIXBIT /SPLSYS/ ;SPOOLER'S PPN
0 ;ZERO TO KEEP IT RUNNING.
XSRUNB:
XSPNAM: SIXBIT /[XSPL]/
SIXBIT /SPLSYS/
0
SAVEAC: BLOCK 20
MAILBK: ;SAVE SPACE
CMDBUF: BLOCK 200
SPLJBN: BLOCK 1
RETADD: BLOCK 1 ;SAVE HIS RETURN ADDRESS
↑XGPFLG:0 ;-1 FOR XGP CALL, 0 FOR LPT
PDLIST: BLOCK PDLEN
RQIOWD: IOWD 200,CMDBUF
IOWD 16,XFNTCM
0
XFNTCM: REPEAT 10,{-1}
'FIX25 '
'FNT '
0
'XGPSYS'
0
0
PURE
CFORM←←0
RQNAM←←1
RQJOB←←2
FDEV←←3
DEVMOD←←4
FSIZE←←5
RQTIME←←6
FNAME←←7
FPPN←←12
CBITS←←16
PSPEC←←20
MRET: MOVSI 17,SAVEAC
BLT 17,17
POPJ P,
↑SPALL: MOVEM 17,SAVEAC+17 ;SAVE AC 17
MOVEI 17,SAVEAC ;LOAD BLT POINTER
BLT 17,SAVEAC+16 ;SAVE THE AC'S
MOVE P,[IOWD PDLEN,PDLIST] ;MAKE A PDL
PUSH P,[CAM MRET] ;SAVE RETURN ADDRESS
MOVEM P,RETADD ;SAVE PRESENT PDP.
SETZM CMDBUF
MOVE C,[CMDBUF,,CMDBUF+1]
BLT C,CMDBUF+177
MOVE D,[SPOOLD,,CMDBUF] ;BLT AC
BLT D,CMDBUF+PSPEC-1 ;LAST WORD OF DESTINATION
MOVEI D,0
DSKPPN D,
SKIPN CMDBUF+FPPN ;IS THERE AN EXPLICIT FILE PPN?
MOVEM D,CMDBUF+FPPN ;NO. SET ONE.
PUSHJ P,SPOOLZ ;CALL COMMON PORTION
RETURN: MOVE P,RETADD
CPOPJ: POPJ P,
SPOOLZ: PUSHJ P,SPLSTS ;MAKE SURE THE SPOOLER'S ALIVE.
SKIPN B,CMDBUF+FDEV ;ANY DEVICE THERE?
MOVSI B,'DSK' ;NO USE DISK
CAME B,['DSK ']
JRST NOLOOK ;DON'T DO LOOKUP IF NOT DISK.
MOVEI A,17
SETZ C,
OPEN DSKSP,A
JRST NODISK
;LOOKUP THE FILE THAT HE GAVE ME.
MOVE D,[CMDBUF+FNAME,,A]
BLT D,D
HLLZ B,B
LOOKUP DSKSP,A
JRST [TTCALL 3,[ASCIZ/Spool: lookup fails
/]
JRST RETURN]
MOVS D,D ;SIZE OF FILE
MOVM D,D ;GET MAGNITUDE
LSH D,-7 ;CONVERT TO BLOCKS
CLOSE DSKSP,
JRST STASH
NOLOOK: MOVEI D,100 ;HERE IF NOT DISK, ASSUME SIZE.
MOVEI A,17
MOVSI B,'DSK' ;OPEN A DISK CHANNEL
SETZ C,
OPEN DSKSP,A
JRST NODISK
STASH: ;SETUP CMDBUF AND WRITE THE FILE
MOVEM D,CMDBUF+FSIZE ;STASH FILE SIZE
TIMER A, ;GET TIME
IDIVI A,74*74 ;MAKE MINUTES
DATE B, ;GET DATE
HRL A,B ;COMPUTE "NOW"
CAMLE A,CMDBUF+RQTIME ;SKIP IF ALREADY SET BIGGER.
MOVEM A,CMDBUF+RQTIME ;WAS SET SMALL. SET IT TO NOW.
GETPPN A, ;GET USER NAME
MOVEM A,CMDBUF+RQNAM
MOVE A,['NP ',,1]
MOVEM A,CMDBUF+CFORM
SETO B,
TTCALL 6,B
PJOB A,
HRL B,A
MOVEM B,CMDBUF+RQJOB ;SAVE JOB#,,LINE NUMBER OF REQUESTOR
DATE A,
TIMER B,
LSH A,30
OR A,B
AGAIN: MOVSI B,'SPX'
SKIPE XGPFLG
MOVSI B,'XSP'
SETZ C,
MOVE D,SPLPPN
LOOKUP DSKSP,A
JRST .+2
AOJA A,AGAIN
MOVSI B,'SPX'
SKIPE XGPFLG
MOVSI B,'XSP'
SETZ C,
MOVE D,SPLPPN
ENTER DSKSP,A
AOJA A,AGAIN
MOVE F,[IOWD 16,XFNTCM]
SKIPN XGPFLG
MOVEI F,0
MOVEM F,RQIOWD+1
OUTPUT DSKSP,RQIOWD
STATZ DSKSP,740000
JRST OUTERR
CLOSE DSKSP,
RELEAS DSKSP,
SETZM MAILBK
MOVE A,[XWD MAILBK,MAILBK+1]
BLT A,MAILBK+37
MOVE A,SPLJBN
MOVEI B,MAILBK
SEND A
JFCL
POPJ P,
SPLSTS: SKIPE XGPFLG
SKIPA A,XSPNAM
MOVE A,SPLNAM
CALL A,[SIXBIT/NAMEIN/]
PUSHJ P,INTSPL ;OUGHT TO INIT SPOOLER
MOVEM A,SPLJBN ;INTSPL ALSO RETURNS A.
JBTSTS A,
TLNN A,20000
POPJ P, ;QUICK RETURN
TTCALL 3,[ASCIZ/
Spool: The spooler has crashed. Your output will be printed after
the spooler is restarted.
/]
POPJ P,
;SEE ABOUT STARTING A SPOOLER
INTSPL: TRNE A,2 ;SKIP IF NO JOBS LOGGED IN.
JRST MULSPL ;OOPS MORE THAN 1 SPOOLER ALREADY
MOVEI A,SPRUNB ;LOAD THE ADDRESS OF THE RUN BLOCK
SKIPE XGPFLG
MOVEI A,XSRUNB
CALL A,['WAKEME']
JRST NOWAKE ;WAKEME FAILURE
MOVEI B,30 ;WAIT FOR SPOOLER TO HAPPEN
INTSPS: MOVEI A,1
SLEEP A, ;SLEEP AND WAIT FOR SPOOLER TO BE ALIVE.
SKIPE XGPFLG
SKIPA A,XSPNAM
MOVE A,SPLNAM
CALL A,[SIXBIT/NAMEIN/]
SOJGE B,INTSPS
JUMPGE B,CPOPJ
JRST INTCFN ;CONFUSION. I JUST MADE A SPOOLER
NODISK: TTCALL 3,[ASCIZ/Spool: init failed on dsk
/]
JRST RETURN
OUTERR: TTCALL 3,[ASCIZ/Spool: output error on dsk
/]
JRST RETURN
INTCFN: TTCALL 3,[ASCIZ/Spool: I just made a spooler, but now i can't find it.
/]
JRST RETURN
MULSPL: TTCALL 3,[ASCIZ/Spool: There are multiple spoolers. Everyone loses
/]
JRST RETURN
NOWAKE: TTCALL 3,[ASCIZ/Spool: The WAKEME uuo to start the spooler failed.
/]
JRST RETURN
BEND
;TELBUF,CHKUP,CHECKU,CHTEXT,ASCASC,CHOUT3,CHOUT6
;EXTERNAL $ADTYP,$OPLOO
IMPURE
SAVEAC: BLOCK 20
TELBUF: BLOCK 200 ;WE MAY USE SOME EXISTING SPACE WHEN DEBUGGED
CHFILE: SIXBIT /TELLME/
SIXBIT /001 /
0
SIXBIT / EALS/
CHUSET: USETO DSKCH,1 ;Address field set by a UGETF
TELFL3: -1 ;Counter to cause checksum every N times
PURE
CHEXT: SIXBIT /001 /
CHPPN: SIXBIT / EALS/
CHKUP: MOVEI T,0
MOVE TT,[400000-ENDPUR,,0]
ADD T,400000(TT)
AOBJN TT,.-1
JFCL
POPJ P,
COMSUM: PUSHJ P,CHKUP
MOVEM T,CHKSUM
POPJ P,
MONTH: ASCII /Jan. /
ASCII /Feb. /
ASCII /Mar. /
ASCII /Apr. /
ASCII /May /
ASCII /June /
ASCII /July /
ASCII /Aug. /
ASCII /Sep. /
ASCII /Oct. /
ASCII /Nov. /
ASCII /Dec. /
SUMERR: ASCIZ /Checksum error /
CHREGE: ASCIZ / Accum. /
CHINDE: ASCIZ / Index /
CHADDR: ASCIZ / Eff.Address /
CHADDC: ASCIZ / held /
CHOUTB: ASCIZ / Out of bounds/
CHCOMM: ASCIZ /Last com.addr./
CHCHAR: ASCIZ /Last chars/
CHARGU: ASCIZ /Last arguments/
CHPDLM: ASCIZ /PDL addresses /
CHREGS: ASCIZ /All registers /
CHRETU: ASCIZ /Return-2 /]
CHALIA: ASCIZ / Alias /]
;Copies text from location pointed to by B to location pointer to by A
CHTEXT:MOVEI TT,17
ILDB C,B
JUMPE C,.+3
IDPB C,A
SOJG TT,.-3
POPJ P,
CHCRLF: MOVEI C,15
IDPB C,A
MOVEI C,12
IDPB C,A
POPJ P,
;Transfer 5 characters ascii in T to ascii by pointer A, ignoring nulls
;and replacing special characters by 2-char. strings.
;Note that T is displaced to right
ASCASC: MOVE B,[POINT 7,T,0]
MOVEI TT,5
ASCAS2: ILDB C,B
JUMPE C,ASCAS3
CAIN C,11
JRST [MOVEI C,"T"↔IDPB C,A↔MOVEI C,"B"↔IDPB C,A↔POPJ P,]
CAIN C,12
JRST [MOVEI C,"L"↔IDPB C,A↔MOVEI C,"F"↔IDPB C,A↔POPJ P,]
CAIN C,13
JRST [MOVEI C,"V"↔IDPB C,A↔MOVEI C,"T"↔IDPB C,A↔POPJ P,]
CAIN C,14
JRST [MOVEI C,"F"↔IDPB C,A↔MOVEI C,"F"↔IDPB C,A↔POPJ P,]
CAIN C,15
JRST [MOVEI C,"C"↔IDPB C,A↔MOVEI C,"R"↔IDPB C,A↔POPJ P,]
CAIN C,175
JRST [MOVEI C,"A"↔IDPB C,A↔MOVEI C,"T"↔IDPB C,A↔POPJ P,]
CAIN C,177
JRST [MOVEI C,"B"↔IDPB C,A↔MOVEI C,"S"↔IDPB C,A↔POPJ P,]
IDPB C,A
ASCAS3: SOJG TT,ASCAS2
POPJ P,
;Changes six-bit in D into ascii omitting blanks and stores at pointer A
CHOUT3: MOVEI T,3
SKIPA
CHOUT6: MOVEI T,6
MOVE B,[POINT 6,D]
ILDB C,B
JUMPE C,.+3
ADDI C,40 ;Convert to ASCII
IDPB C,A
SOJG T,.-4
POPJ P,
COMOUT: LDB C,[POINT 2,TT,17]
ADDI C,60
IDPB C,A
LDB C,[POINT 7,TT,35]
IDPB C,A
POPJ P,
;Converts # in left half of TT into ascii and stores at pointer A
LHOCTS: MOVEI C,6
MOVEI T,0
LSHC T,3
ADDI T,60
IDPB T,A
SOJG C,.-4
POPJ P,
;This warns of trouble once and inhibits WRPAGE. If user presists (like I will do
;during testing) no further warning will be given but E may blow in other ways.
CHECKU: SKIPL 115 ;Check protection status of upper
POPJ P, ;Don't bother if upper is not write protected
AOS C,TELFL3 ;Add to WRPAGE count
TRNE C,7 ;Do a check sum only every 8 times
POPJ P, ;Not this time
SKIPE TELLFL#
POPJ P, ;One warning should be enough
SETOM TELLFL
U)d⊂(*εE∧T*id⊂∀⊗**εB∧h*iR%⊂(⊗⊂d%jhβE∧a`SbP*⊗⊂d%ijSFE∧e∀)j⊂↔
ZεE∧T'h⊂(**εEαh'h⊂∀⊗*εEαh'h%λ(⊗εEαh'h⊂∀⊗**εB∧h'hλ(⊗*εB∧h*iR%⊂(⊗⊃!$FEαgjj)U)⊂-`Tadm⊂FE∃∃λ*x82\⊂9rs[rw:⊂→y97yλ4w⊂"HP⊂)2\7y:⊂≥97zq≠2P:7H0v6⊂≥yry9H1<P8_srP9↑yz2vK∃∃εE
∃⊂!w[vpw2λ0q7y≥2r⊂P∪2|:⊂∃i$j"H;tv6λ;wy5H1:z⊂≠p|P3Xy10sYP80sYW⊂⊂"↑4z⊂3≤7vP"KεE∃∃
12P9]y2P:≠P3t{→P0P!H_∀P0[2⊂;pZz⊂37\⊂892\rw:⊂≥x82yλ9rsvYw:⊂:≠P3wP_{p|WnFE∧Sgk"P∀⊗-Vf∀"&∃XK⊗("&↔FE∧`SiP∀(
FE∧h∪h%⊂(εE)j∪h%!]βE∧gjU)j)⊂⊗`iadV↔FE'[2P6w[rw:⊂≤62pyYVP P→92rP≤z7y0YrP2y≤7y⊂9→x7y:→r↔⊂↔WFE∧h∃id%⊂∀⊗#!$CE∧gjU)j)⊂⊗`iadV↔FE)→qw{2\<P;t[6⊂77]⊂12P_z:2v\:2r↔nFE∧R))j⊂
⊗↔∧]R:yz⊂≤2x7y≥9P0w→⊂167]yP0yH:yzp[↔εEεB≥j$"H#'f&∪kdg#H!gb"H$iP(∀"ibg∃&,P'∪j⊂*iQb⊂ iH!gb"H+`iP∀*j⊂$S⊂"$i⊃aj&,CE≥dw≤ry:⊂_z⊂*c⊂j f⊂≥7P92\7y:⊂→{2w:λ4w1v≥r4w3H6ryyXsrWεB≥ij'T*c≥∧Tbj'fH*"f#∪→⊃D]Upw:⊂≠ryypYrP92\97r:XrrεE∞Dh*iR%⊂(⊗⊃!$FE∞Dh'h∩⊂(⊗εBβ≥j"f∪&bV#⊂$FE*⊃f&&bN∧gjj∀j)⊂-Piadmλ↔FE,[zP0y→P:w2→y⊂9z\;2tv≠0w1rHP↔nFB∧h*iR%⊂(⊗⊃!$FEαh'h%λ(⊗εEβE#!$N∧fgk⊃fP_[K)`k"PaUX[CE∧fgU"dP_MV)`k⊃`aFEαa&*⊂[V)`U"`aUL[εE∧Sgk"P∀⊗)`k⊃`aUXMD]g7H92py[w⊂:7H6purH0w7z~2y⊂8≥yt⊗r≠{w⊂6~yzεEαibj-∪Dj"f⊂*cεEαfgk"Bj⊗-j⊃f!*c⊗*"f⊂*c∃XWFE∧a∪*∧j⊗∃"f!*Q∃X[[B]av2Xy⊂:4→P1:s→2yεE∞h:z⊂→0z2P_w2⊂:~vrV⊂≤97sy_vvry⊂34v→P0w2λ80srH7:vq→y⊂7wλ34y9]⊂64w→FE∧fSk"P K-h'dS*⊂≠V∃"f!*Q∃XnFB∧b j⊃DaV∧BD]cbU⊂" j⊃FE∧fSk"dP⊃⊗_εEαdb$k∩P!V≡LXFE∧Sgk"P∃⊗"εEα`b"$H*⊗_DB]j44\P4yP≥42P2_|FE∧T*id%λ(⊗'*Sij)∧B]crzλ4z⊂4[⊂≠Vq~zεE∧Sgk"dH"V_XBD]j P⊂9rx_y0z7\εE∧dQ(!⊂"K FE⊂λεE∧fSk"dP⊃⊗_εEαdb$k∩P!V≡LYεE∧Sgk"P⊂V&gg∃$∀"∀BD]j4~yP4yH:42P≠ww:4λ4w⊂≠Kq4zεB∧fgk⊃fP!V∃"f!*QεEεEαj$fbT∧a⊗∧BD]cbU⊂*$fQFE∧dQ$k$DP⊗≠Z∃
Z∧DDNf`ebH&dg*U"iFEαfgk"RP!V_βE∧db∩k$P!≡[_∧B]d7z\⊂4yP~w⊂!⊂_w2⊂6Zw:z2\P4w⊂⊂FE∧fSk"P*!εE∧T*id%λ(⊗⊂'∃fij)βE∧fgU"dP!⊃≥⊃εB∧db(⊂⊂!⊗ CE∧fgU"P*⊗⊂FE∧h∃id%⊂∀⊗'*fTj)εEαdb(!λ"V FB∧fgk⊃P"⊗)∀('∧DNcrz⊂≥yry9H70vrCE∧h*Td%⊂(!d'jU→FE∧Sgk"dH!V⊃⊗λεE∧dQ(!⊂!K FE∧R)&-)H"εE∧T*id%λ(⊗!d∪jj→FB∧db(⊂⊂"V CE∧fgU"P"⊗∀('∧DNcrz⊂≥yry9H0v4p\FE∧aPfg⊂")(('βE∧e)∀j⊂↔∃LXFE∧Sgk"P⊂⊗-h'Rg*⊂≠K!d f∩`nFEαh*id∩⊂(⊗!R*"l*βE∧h*Td%⊂(!d'jU→FE∧Sgk"dH!V⊃⊗λεE∧dQ(!⊂!K FE∧R)&-)H"εE∧T*id%λ(⊗!d∪jj→FB∧db(⊂⊂"V CE∧fgU"P"⊗⊃b#$fαD]cr]⊂34v→P70vYFE∧h∃id%⊂∀⊗!d'Uj≠εEαd&&-λ"⊗"b⊃$f∃XBD]cr]⊂2|:→w9tw[εE∧e∃fh"P⊃⊗↔∃ZαD]fp↑P12P≠tyyt[3FE∧Sgk"dH!V⊃↔λεE∧dQ(!⊂!K FE∧T*id%λ(⊗!d∪jj→FB∧fgk⊃P"⊗"Q#$f∃LDD]cYz⊂34[2P((∪εE∧e∃fh"P⊃⊗↔∃XLεE∧fSk"dP⊂V⊃-QβE∧db∀!⊂!V⊂FE∧h∃id%⊂∀⊗!d'Uj→FEαfgk"RP!V⊃⊃εE∧Rb(!⊂⊂V FEαd)&-∀P"εEαh*id∩⊂(⊗!R'jj→CE∧fgU"dP!K⊃.QεB∧db(⊂⊂!V CE∧db∀!⊂"V⊂FE∧fSk"dP⊂V⊃(⊃βE∧db∀!⊂!V⊂FE∧fSk"P*!ji(⊂cDD]Qrz⊂8_srP7≥vq2yβE∧h*Td%⊂('*fiU)εE∧Rb(!⊂⊃V FEαfgk"RP!V⊃∪⊃εE∧Rb(!⊂⊂V FEαfgk"H*⊗ i∀&∧D]Qrz⊂6~w2P7≥vq2yβE∧h*Td%⊂('*fiU)εE∧T*id%λ(⊗!d⊂iεB≥h:zλ30z0[⊂2y9≠y⊂6r\ypsrH72|:λ4s⊂:~2y2P~yP7w→FE∧iRdh'⊂∃"f#&εE∧e∀)j⊂!R)jfbCE∧ibU-&P*⊃f#&→βE∧fgU"P!⊗⊗h'dg∃⊂≠V_↔FE∧d∀)⊂!⊗
_∧D]Qrz⊂9]0y:4[3P0r→92yyH397vH%'a*UgFE∧Rf"!⊂⊂V!εEαe*fh⊃P!V↔
YFE∧Rb(!⊂⊂V FEαe))jλ↔⊗YFB∧h*iR%⊂(⊗⊂d!i&⊃εE≥h≥z⊂!d∞ECKSUM error on the second line if one exists
CHSUME: PUSHJ P,CHKUP
SUB T,CHKSUM
JUMPE T,CHKUP2
MOVE B,[POINT 7,SUMERR]
PUSHJ P,CHTEXT
MOVE TT,T
PUSHJ P,LHOCTS ;Convert left half into six character OCT string
IDPB E,A
PUSHJ P,LHOCTS ;Convert former right half into OCT string
IDPB E,A
MOVEI C,15 ;End CHKSUM line
IDPB C,A
MOVEI C,12
IDPB C,A
JRST CHKUP2
;Put blow-up location and instruction for reference on third line
CHKUP2: MOVEI E,40
MOVE B,[POINT 7,CHRETU]
PUSHJ P,CHTEXT
IDPB E,A
MOVE T,SAVEAC+17 ;Get P value at entry time
SUBI T,1 ;Allowance for double PUSHJ
HRRZ TT,(T) ;Get POPJ address
SUBI TT,2 ;We want location before PUSHJ
MOVEM TT,D
HRLZS TT
PUSHJ P,LHOCTS ;Convert left half into six character OCT string
IDPB E,A
IDPB E,A
MOVE TT,(D) ;Get the instruction itself
PUSHJ P,LHOCTS ;Convert left half into six character OCT string
IDPB E,A
PUSHJ P,LHOCTS ;Convert former right helf into OCT string
PUSHJ P,CHCRLF
;Report contents of specified register and effective address
CHKUPA: MOVE B,[POINT 7,CHREGE]
PUSHJ P,CHTEXT
MOVE D,(D) ;Get instruction into D
MOVE B,[POINT 4,D,12]
LDB T,B ;Get register address
MOVEM T,TSAVE#
PUSHJ P,OCTSTR ;Report the register
MOVE B,[POINT 7,CHADDC] ;Say HELD
PUSHJ P,CHTEXT
MOVE T,TSAVE
MOVE T,SAVEAC(T) ;Get contents
PUSHJ P, OCTSTR ;Want it in OCTAL
MOVE B,[POINT 4,D,17] ;Pointer to index position
LDB T,B ;Get its number
MOVEM T,TSAVE# ;We will need this again
SETZM TTSAVE# ;Ready for no index case
JUMPE T,.+13
MOVE B,[POINT 7,CHINDE]
PUSHJ P,CHTEXT ;Write text
MOVE T,TSAVE ;Get index address back
PUSHJ P,OCTSTR ;The index
MOVE B,[POINT 7,CHADDC] ;Say HELD
PUSHJ P,CHTEXT
MOVE T,TSAVE ;And again
HRRZ T,SAVEAC(T) ;Get contents of index
MOVEM T,TTSAVE ;Save to add to address
PUSHJ P,OCTSTR ;Report contents in OCT of index register
MOVE B,[POINT 18,D,35]
LDB TT,B
ADDB TT,TTSAVE
MOVE B,[POINT 7,CHADDR] ;Some text
PUSHJ P,CHTEXT
HRLZ TT,TTSAVE
PUSHJ P,LHOCTS ;Report effective address itself
MOVE TT,TTSAVE
CAIG TT,@JOBREL ;Is address above job's lower segment?
JRST .+4 ;No
CAIG TT,ENDPUR ;Is it beyond limit of upper segment?
CAIGE TT,400000 ;or maybe in between lower and upper?
JRST CHKUPZ ;It IS out of bounds
CAILE TT,17
MOVE T,(TT)
CAIG TT,17
MOVE T,SAVEAC(TT)
MOVEM T,TSAVE
MOVE B,[POINT 7,CHADDC] ;Say HELD
PUSHJ P,CHTEXT
MOVE T,TSAVE
PUSHJ P,OCTSTR ;Report OCT contents of effective address
JRST CHKUPB
CHKUPZ: MOVE B,[POINT 7,CHOUTB]
PUSHJ P,CHTEXT ;Report address out of bounds
CHKUPB: PUSHJ P,CHCRLF
;Put the last five command addresses on the next line
MOVEI E,11
MOVE B,[POINT 7,CHCOMM] ;Some text
PUSHJ P,CHTEXT
IDPB E,A
HRLZ TT,LSTCOM
PUSHJ P,LHOCTS
IDPB E,A
HRLZ TT,LSTCO2
PUSHJ P,LHOCTS
IDPB E,A
HRLZ TT,LSTCO3
PUSHJ P,LHOCTS
IDPB E,A
HRLZ TT,LSTCO4
PUSHJ P,LHOCTS
IDPB E,A
HRLZ TT,LSTCO5
PUSHJ P,LHOCTS
PUSHJ P,CHCRLF
;Put the last five command characters on the next line
MOVE B,[POINT 7,CHCHAR] ;Some text
PUSHJ P,CHTEXT
IDPB E,A
MOVE T,LSTCH1
PUSHJ P,ASCASC ;Move ascii to ascii
IDPB E,A
MOVE T,LSTCH2
PUSHJ P,ASCASC ;Move ascii to ascii
IDPB E,A
MOVE T,LSTCH3
PUSHJ P,ASCASC ;Move ascii to ascii
IDPB E,A
MOVE T,LSTCH4
PUSHJ P,ASCASC ;Move ascii to ascii
IDPB E,A
MOVE T,LSTCH5
PUSHJ P,ASCASC ;Move ascii to ascii
PUSHJ P,CHCRLF
;Put the last five command arguments on the next line
CHKUPC: MOVE B,[POINT 7,CHARGU] ;Some text
PUSHJ P,CHTEXT
IDPB E,A
MOVE T,LSTARG
PUSHJ P,NUMSTR
IDPB E,A
MOVE T,LSTAR2
PUSHJ P,NUMSTR
IDPB E,A
MOVE T,LSTAR3
PUSHJ P,NUMSTR
IDPB E,A
MOVE T,LSTAR4
PUSHJ P,NUMSTR
IDPB E,A
MOVE T,LSTAR5
PUSHJ P,NUMSTR
PUSHJ P,CHCRLF
MOVEI E,40
;Put the registers next
CHKUPD: MOVE B,[POINT 7,CHREGS] ;Some text
PUSHJ P,CHTEXT
PUSHJ P,CHCRLF
MOVNI D,20
HRLZS D
MOVEI C,6
MOVE TT,SAVEAC(D)
PUSHJ P,OCTASC
IDPB E,A
AOBJP D,.+7
SOJG C,.-4
MOVEI C,15
IDPB C,A
MOVEI C,12
IDPB C,A
JRST .-12
PUSHJ P,CHCRLF
;Put POPJ addresses from PDL on the next line if space permits
MOVE B,[POINT 7,CHPDLM] ;Some text
PUSHJ P,CHTEXT
PUSHJ P,CHCRLF
HRRZ D,P
; SKIPA ;Commented out because of double PUSHJ
CHKUP3: SUBI D,1
CAIGE D,PDL
JRST CHKUP4
HRRZ C,A ;POINTER ADDRESS
SUBI C,TELBUF-1
CAIG C,3 ;Allow for maximum of 15 characters
JRST CHKUP4 ;Not enough room so stop
HRLZ TT,(D) ;Get popj address
PUSHJ P,LHOCTS
IDPB E,A
JRST CHKUP3
CHKUP4: MOVEI C,15
MOVEI D,12
IDPB C,A
IDPB D,A
HRRZ T,A
SUBI T,TELBUF-1
PUSHJ P,NUMSTR ;Report words used for record
IDPB C,A ;Separate records
IDPB D,A
IDPB C,A
IDPB D,A
MOVE T,CHEXT ;Start with EXT of 001
MOVEM T,CHFILE+1
WRITIT: OPEN DSKCH,[17↔'DSK '↔0]
JRST 4,.
MOVE T,CHPPN
MOVEM T,CHFILE+3 ;This must be reset
LOOKUP DSKCH,CHFILE
JRST .+2 ;Assume that it does not exist
MOVEM T,CHFILE+3 ;This must be reset
ENTER DSKCH,CHFILE
JRST WRITT2
UGETF DSKCH,T
HRRM T,CHUSET
XCT CHUSET
OUT DSKCH,[-200,,TELBUF-1↔0]
SKIPA
JRST WRITT2
CLOSE DSKCH, ;We assume that 128 words will be enough always
RELEAS DSKCH,
MRET: MOVSI 17,SAVEAC
BLT 17,17
POPJ P,
WRITT2: MOVE T,CHFILE+1 ;If file is busy create a new one
ADD T,[1,,0]
MOVEM T,CHFILE+1
CLOSE DSKCH,
JRST WRITIT ;Try again
;PDL, PATCH, PAT, ZVARS, LEGTAB
IMPURE
PDL: BLOCK LPDL
EPDL←←.-1 EPDL2←←.-2
PATCH:
PAT: BLOCK 100
TYIPNT: 0
TCPNT: 0
SYSCMD: 0
ZVARS: 0
VAR
DIR: BLOCK LPDESC
DIR2: BLOCK LPDESC ;Saved-directory reference
DIREN2: BLOCK LPDESC ;End of saved-directory reference
FNDTBF: BLOCK SUBBUF+SRSIZ ;To hold both strings for F commands
FNDBUF: BLOCK SUBBUF+SRSIZ ;To hold both strings for X command
SRDUMY: BLOCK SRCBUF
BITBF1: BLOCK 4
BITBF2: BLOCK 4
SBBUF: BLOCK 4
MBBUF: BLOCK 4
VBBITS: BLOCK 6
SBLST: BLOCK 2
BUF: BLOCK 40
BUF2: BLOCK 40
TCBUF←←BUF2
RBUF: BLOCK 40
RSPNT←←RBUF
EVARS←←.-1
PURE
LEGTAB: FOR @! X←0,LEGNUM-1{LEG!X
}LEGCNT←←LEGNUM
XLIST ;THE LITERALS ARE XLISTED FOR YOUR READING PLEASURE
LIT ;DO THESE LAST FOR OPTIMIZATION
LIST
ENDPUR←←.
CHKSUM: 0 ;To hold initial check sum computed in S 137
IMPURE
IFE PURESW,{PURLST←←PURLNK}
ENDLOC←←.
END BEG